Answers for "c# record"

C#
0

c# record

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

    public Person(string first, string last) => (FirstName, LastName) = (first, last);
}
Posted by: Guest on November-18-2020
0

c# record

public sealed record Student : Person
{
    public int Level { get; }

    public Student(string first, string last, int level) : base(first, last) => Level = level;
}
Posted by: Guest on November-18-2020
0

c# record

public record Teacher : Person
{
    public string Subject { get; }

    public Teacher(string first, string last, string sub)
        : base(first, last) => Subject = sub;
}
Posted by: Guest on November-18-2020

C# Answers by Framework

Browse Popular Code Answers by Language