'Why a deconstruction cannot mix declarations and expressions on the left
I have this code:
public static (int a, int b) f12()
{
return (1, 2);
}
public static void test()
{
int a;
(a, int b) = f12(); //here is the error
}
When I try to compile it I get an error:
A deconstruction cannot mix declarations and expressions on the left
I don't understand why. Any suggestions?
Solution 1:[1]
This is a more precise answer to my question:
May lead to occasional confusion, as in M((int x, y) = e) (declaring y)? [...]
Taken from Mixing fresh and existing variables in deconstruction mentioned by Brian's answer.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | G. Lari |
