Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# record

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

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

record keyword c#

//a record is like a simple way to declare a class

public record Person(string name,int age);

Person p1=new person("John",21);
Person p2=new person("Jane",24);
Comment

c# record

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

    public Student(string first, string last, int level) : base(first, last) => Level = level;
}
Comment

c# record

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

    public Teacher(string first, string last, string sub)
        : base(first, last) => Subject = sub;
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: Appending to an Existing CSV File with csvhelper 
Csharp :: c# variables 
Csharp :: c# deeply related children 
Csharp :: instance vs initiate 
Csharp :: sql to linq converter online tool free 
Csharp :: CefSharp.Core in clickones application 
Csharp :: isselected uicollectionview reused 
Csharp :: Razor switch statement 
Csharp :: unity dictionary foreach remove 
Csharp :: c# bitwise xor 
Csharp :: ASP.MVC display image from SqlServer 
Csharp :: two question marks together mean in C# 
Csharp :: open and close autocad api 
Csharp :: how to remove a parten transform unity 
Csharp :: who is dani? game dev 
Csharp :: c# sort a list of objects 
Csharp :: c# stringwriter encoding iso-8859-1 example 
Csharp :: c# access control from another thread 
Csharp :: c# Color Convert 
Csharp :: Razor while loop 
Csharp :: unity how to have multiple headers 
Csharp :: how to set an expiry date on a program 
Csharp :: PUN 2 Network Transform View Jittery Movement 
Csharp :: save checkbox value to database c# 
Csharp :: populate toolstripitems to combobox 
Csharp :: An unhandled exception occurred during the execution of the current web request 
Csharp :: Options Pattern how to use 
Csharp :: how to make projectile track and go to specified enemy in unity 
Csharp :: ASP.NET Core set update clear cache from IMemoryCache (set by Set method of CacheExtensions class) 
Csharp :: Handle all AggregateExceptions when using Task.Whenall() async 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =