-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
Deconstruction in from and let
- Specification: Not added. See below.
- Discussion: Champion "deconstruction in from and let" #8874
Summary
We only were able to implement P0 deconstruction scenarios in C# 7, which leaves a number of candidates unaddressed (let clause, from clause, lambda, method declaration, using, outvar, join clause, query continuation clause, join into clause, catch).
The first three in particular could use further investigation.
From clause
Instead of:
(int, int)[] tuples = new[] { (1, 2), (3, 4) };
var query = from t in tuples
select t.Item1;Allow:
var query = from (x, y) in tuples
select x;Let clause
var query = from deconstructable in deconstructables
let (x, y) = deconstructable
...;Lambda
Instead of:
tuples.Select(t => t.Item1 + t.Item2);Allow:
tuples.Select((var (x, y)) => x + y);
// the lambda takes one argument that is not named
// and can be broken into two partsOr maybe this syntax instead:
tuples.Select(((x, y)) => x +y); // same number of parentheses, but denserDesign meetings
Reactions are currently unavailable