Complete the code to declare a record type named Person.
public [1] Person(string Name, int Age);The record keyword declares a record type, which is a reference type with value-based equality.
Complete the code to create a new Person record with name 'Alice' and age 30.
var person = new Person([1], 30);
String values must be enclosed in double quotes in C#.
Fix the error in comparing two Person records for equality.
bool areEqual = person1 [1] person2;Records support value-based equality using the == operator.
Fill in the blank to create a copy of a Person record with a changed Age.
var olderPerson = person with [1];
The with expression uses braces to specify property changes in a record copy.
Fill all three blanks to define a record with positional parameters and override ToString method.
public [1] Person(string Name, int Age) { public override string ToString() => $"[2] is [3] years old."; }
Records are declared with record. The ToString method uses the properties Name and Age to display info.