Record

 // See https://aka.ms/new-console-template for more information

Console.WriteLine("Hello, World!");



var std = new Student("Sabir", 21);

Console.WriteLine("Name=" + std.Name);


//std.Name = "Tejas";


var std2 = std with { Name = "Tejas", age = 22 };


Console.WriteLine("Name=" + std.Name);

Console.WriteLine("Name=" + std2.Name);

public record Student(string Name, int age);





Comments

Popular posts from this blog

Method Function