Tracker: LINQ query expression proposals #116
Replies: 9 comments
-
For Linq-Methods using two IEnumerables (such as Zip, Union, Except, Concat, Intersect) I'd rather see an extendable syntax allowing to use userdefined extention methods, as suggested in #117 (comment) |
Beta Was this translation helpful? Give feedback.
-
And what happens for the dozen extension methods I've defined myself on |
Beta Was this translation helpful? Give feedback.
-
I'd rather see a spec for #100 as it can cover most (all?) of these. (except for #101 which is just a statement form of query expressions and doesn't really belong here). |
Beta Was this translation helpful? Give feedback.
-
@alrz why not write one? |
Beta Was this translation helpful? Give feedback.
-
This has some interaction with #101 so I think it's better to wait for a proposal for #101 first. |
Beta Was this translation helpful? Give feedback.
-
@alrz: The idea is definitly not a bad one, but I miss the possibility to continue with my query after executing the do-operation. It doesn't make much sense on a call to Single/First/Last/..., but when I use from x in (
from x1 in something
let x2 = dosomething(x1)
select new{x1, x2}
do WeirdPseudoSort() // still returns an IEnumberable<T>, not a single T
)
let x1 = x.x1;
let x2 = x.x2;
let x3 = dosomethingelse(x1,x2)
select x3; I'd like to see a keyword that allows packing the current contect (all variable values from inside the linq statement) into a tuple then processing those tuples, unpacking them before evaluating the next linq query. |
Beta Was this translation helpful? Give feedback.
-
@phi1010 (also @orthoxerox)
I think var q =
from x1 in something
let x2 = func1(x1)
do TakeWhile(!x1.foo)
select func2(x1, x2);
var q = something
.Select(x1 => (x1, x2: func1(x1)))
.TakeWhile(t => !t.x1.foo)
.Select(t => func2(t.x1, t.x2)); That makes it a more complicated because currently query terminations (group and select) need an |
Beta Was this translation helpful? Give feedback.
-
@alrz see the discussion in #333, it is able to continue the expression, but Matt considers the can of worms it opens to be too big to approve of this. |
Beta Was this translation helpful? Give feedback.
-
(take) while
(TakeWhile()
,SkipWhile()
)do
(foreach
)Aggregate()
)All(), Any()
)Average()
,Sum()
,Count()
,Min()
,Max()
)Concat()
,Except()
,Intersect()
,Union()
)Distinct()
)First()
,FirstOrDefault()
,Single()
,SingleOrDefault()
,Last()
,LastOrDefault()
)take
,skip
(Take()
,Skip()
)with
(Zip()
)apply
to callToList()
etcleftjoin, rightjoin
Beta Was this translation helpful? Give feedback.
All reactions