record c# 9 code example
Example 1: c# record
public sealed record Student : Person
{
public int Level { get; }
public Student(string first, string last, int level) : base(first, last) => Level = level;
}
Example 2: c# record
public record Person
{
public string LastName { get; }
public string FirstName { get; }
public Person(string first, string last) => (FirstName, LastName) = (first, last);
}