DEV Community

Discussion on: Deconstruction in C#

Collapse
 
bulegahassan profile image
BulegaHassan

Thanks, its an awesome blog about deconstructing. Additionally one can use discards to ignore some values after deconstructing. We use an underscore(_) to ignore that particular variable.

(firstName, _, age) = person;
Console.WriteLine($"{firstName} is {age} years old");
// John  is 30 years old
Enter fullscreen mode Exit fullscreen mode
Collapse
 
charbelsako profile image
Charbel Sarkis

Nice, it's been a while since I've seen csharp code