I'm trying to deconstruct a tuple inside a Linq expression
// somewhere inside another method var result = from word in words let (original, translation) = Convert(word) select original
Here is a signature of the method returning a tuple
(string Original, string Translation) Convert(DictionaryWord word) { // implementation }
But it's not a valid syntax. I can only access tuple values without deconstruction:
var result = from word in words let result = GetWord(word, mode) select result.Original
Is there a proper way to deconstruct it or it's not supported inside Linq expressions?
It is highly curable ... Direct-acting antiviral medications — given over a 12-week period — actually can cure early acute hepatitis C better than 90% of the time.
Logical OR operator: || The logical OR operator ( || ) returns the boolean value true if either or both operands is true and returns false otherwise. The operands are implicitly converted to type bool before evaluation, and the result is of type bool .
Many chronic HCV sufferers also complain of getting aches and pains. Large numbers get sharp pains over the liver (found in the upper right corner of the abdomen) which can sometimes be very alarming. These pains are not necessarily connected with severe liver disease.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With