C# 9.0 - record

class Program{public class Employee{public string? EmployeeId { get; set; }public string? EmployeeName { get; set; }}static void Main(string[] args){Employee employee = new Employee { EmployeeId = “123”, EmployeeName = “Vaibhav” };employee.EmployeeName = “Testing Mutable Property”;Console.WriteLine(employee.EmployeeName);}}
class Program{public record Employee(string EmployeeId,string EmployeeName);static void Main(string[] args){Employee employee = new Employee(“123”,”Vaibhav”);Console.WriteLine(employee.EmployeeName);}}
Value-Based Equality Check
Immutability Check
With Expression Check
Inheritance

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Vaibhav Bhapkar

Vaibhav Bhapkar

Technical Speaker | Computer Engineer | Full Stack Web Developer | ML Enthusiast | * Knowledge Shared = Knowledge² *