Skip to content

Instantly share code, notes, and snippets.

@mirmostafa
Created October 5, 2021 20:05
Show Gist options
  • Select an option

  • Save mirmostafa/4ac2810865a0ce495191d771c9f1089a to your computer and use it in GitHub Desktop.

Select an option

Save mirmostafa/4ac2810865a0ce495191d771c9f1089a to your computer and use it in GitHub Desktop.
internal readonly record struct Person(string Name, int Age);
var people = new List<Person> { new("Ali", 20), new("Reza", 30), new("Mohammad", 40) };
var behzad = people.FirstOrDefault(x => x.Name == "Behzad", new("Behzad", 37));
output: Person { Name = Behzad, Age = 37 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment