tabs ↹ over ␣ ␣ ␣ spaces

by Jiří {x2} Činčura

Nice succinct syntax for tuple deconstruction

25 Jun 2017 1 mins C#

As I’m playing more and more with tuple in C# 7 to find out where this is useful and where it falls short and actually bites back later on. And during this I kind of by blind luck discovered more succinct syntax for deconstruction. I reminds me Python, which I like.

The normal way to deconstruct a tuple looks like this.

(var a, var b) = (10, 20);

But it can be written, with the same result, like this.

var (a, b) = (10, 20);

I don’t know about you, but that’s more pleasant to my eyes.

Profile Picture Jiří Činčura is .NET, C# and Firebird expert. He focuses on data and business layers, language constructs, parallelism, databases and performance. For almost two decades he contributes to open-source, i.e. FirebirdClient. He works as a senior software engineer for Microsoft. Frequent speaker and blogger at www.tabsoverspaces.com.