- 
                Notifications
    You must be signed in to change notification settings 
- Fork 483
Open
Description
C# 9.0 syntax allows now to declare reference types as 'records' which is a nice syntax sugar for (immutable) data-container classes. There's a way to declare a record type as 'immutable':
public sealed record MyRecord(
  string property1,
  int property2,
  object propertyEtc
)
{}This would actually generate a following class:
public sealed class MyRecord 
{
  public string property1 {get; init;}
  public int property2 {get; init;}
  public object propertyEtc {get; init}
  public MyRecord(string property1,  int property2, object propertyEtc)
  {
     this.property1 = property1;
     this.property2 = property2;
     this.propertyEtc = propertyEtc;
  }
 //some other code, like Equals()
}The problem is that ParseArguments<MyRecord>() would fail with System.MissingMethodException: No parameterless constructor defined for type 'MyRecord '. (which there's really none).
While I could declare a prarmeterless constructor for such record, it would be really great to have such classes supported as-is.
seesharprun, miroljub1995 and marax27
Metadata
Metadata
Assignees
Labels
No labels