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 :: unity dropdown 
Csharp :: itext7 pdfwriter outputstream c# 
Csharp :: batchblock timeout 
Csharp :: c# window form align right bottom 
Csharp :: c# list any retun indec 
Csharp :: asp c# page scroll position change after postback 
Csharp :: linq c# object except two lists 
Csharp :: xamarin set environment variables 
Csharp :: translate int to string with x 0 before c# 
Csharp :: Unity Object rotation along any axis 
Csharp :: redis cache repository .net 
Csharp :: declarar lista c# 
Csharp :: unity color alpha not working 
Csharp :: c# integer part of float 
Csharp :: print hello world in unity 
Csharp :: sto playing audiosource 
Csharp :: regex only letters and numbers c# 
Csharp :: declare multiple variables in for loop C# 
Csharp :: mvc model validation for decimal type 
Csharp :: how to set the current user httpcontext.current.user asp.net -mvc 
Csharp :: print text c# unity 
Csharp :: How to get selected item from Dropdown in GridView 
Csharp :: string.insert c# 
Csharp :: wpf databinding 
Csharp :: unity play animation on click 
Csharp :: open project in visual studio using command prompt 
Csharp :: dbset 
Csharp :: datatable select c# 
Csharp :: unity read console log 
Csharp :: wpf dispatcher timer is inaccurate 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =