How to declare a C# Record Type?

Update:

C# 9 now contains record types.

public record Person
{
    public string LastName { get; }
    public string FirstName { get; }

    public Person(string first, string last) => (FirstName, LastName) = (first, last);
}

Old answer:

Record types are not (yet) implemented in C#. See the proposal in the official GitHub repository:

https://github.com/dotnet/csharplang/blob/master/proposals/records.md

Discuss or vote at https://github.com/dotnet/csharplang/issues/39

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)