Deconstructing Records

CSharp · Console

/Program.cs

using System;

public class Program
{
	public static void Main()
	{
		var person = new Person("Kyle", "Mit");
		var (firstName, lastName) = person;
		Console.WriteLine(firstName); // "Kyle"
	}
}


public record Person(string firstName, string lastName) {}
;