More on deconstruction in C# 7
February 9, 2018 Leave a comment
We looked at deconstruction using the new ValueTuple type in this post. This short post only shows a couple more bits and pieces related to object deconstruction in C# 7.
Consider the following Rectangle class:
public class Rectangle { public int Width { get; set; } public int Height { get; set; } }
Let’s see if we can collect the Width and Height properties into a tuple: