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 an independent developer focusing on data and business layers, language constructs, parallelism and databases. Specifically Entity Framework, asynchronous and parallel programming, cloud and Azure. He's Microsoft Most Valuable Professional and you can read his articles, guides, tips and tricks at