4 ms·
It's linked to providing these tuple types out of a method call. So instead of having to declare that Foo returns a FooReturn, it can be declared as (say)
by will_hughes 10y ago
It's linked to providing these tuple types out of a method call.
So instead of having to declare that Foo returns a FooReturn, it can be declared as (say)
public (int ret, string err) Foo() { return (5, "something"); }
- taco_emoji 10y agoThat's not a deconstructor though, which is what the GP was asking about. EDIT: Looks like there's confusion... Yes, you can deconstruct a Tuple like this, but C# 7 also introduces a specific Deconstructor pattern in which ANY class can be deconstructed as though it were a Tuple.