I have a project using .NET Standard 2.1 and .NET core 3.1 - so the C# version is 8.0
According to a few articles I found (e.g. one, two), it should be possible to define a record
type using this syntax:
public class MyRecord(string Input1, int Input2);
But I get many compilation errors, as this syntax for defining a class is clearly incorrect.
Are these articles misleading?
Is the only way to use records to upgrade to C# 9.0, and therefore .NET 5.0?
public record
and notpublic class
– Gracegracefulrecord
givesPredefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported
- it seems to be a feature of c# 9 – InhaulBeginning with C# 9...
– Gracegraceful