Does C# 7 allow to deconstruct tuples in linq expressions

It seems not.

There's an open issue for this on GitHub: https://github.com/dotnet/roslyn/issues/6877

Edit

Issue moved to dotnet/csharplang#355


Deconstruction in Linq queries isn't supported in C# 7.0.

Only three forms of deconstruction made it into C# 7.0 (deconstruction in assignment, in "foreach" loop and in "for" loop). But when the language design committee considered all the possible places that declare variables (and thus would be candidates for deconstruction) and prioritized them, the deconstruction in "let" (and possibly "from") clauses were next in line.

Please make sure to leave a note or a thumbs up on https://github.com/dotnet/csharplang/issues/189 if you feel this would be useful.


You can do something like this:

public static (string Original, string Translation) Convert(string word)
{
    return ("Hello", "Hello translated");
}
static void Main(string[] args)
{
    List<string> words = new List<string>();
    words.Add("Hello");

    var result = from word in words
                    select Convert(word).Translation;

    Console.WriteLine("Hello, world!" + result.FirstOrDefault());
}