Skip to content

LINQ translation #97

Closed
Closed
@lbargaoanu

Description

@lbargaoanu
Expression<Func<int>> expr = ()=>(from s in new[]{"1","2","3","4","5"} let n = int.Parse(s) where n > 3 group s by s into result select result.Count()).Count();
expr.ToReadableString().Dump();

I get

() => new[] { "1", "2", "3", "4", "5" }
    .Select(s => new { s = s, n = int.Parse(s) })
    .Where(<>h__TransparentIdentifier0 => <>h__TransparentIdentifier0.n > 3)
    .GroupBy(
        <>h__TransparentIdentifier0 => <>h__TransparentIdentifier0.s,
        <>h__TransparentIdentifier0 => <>h__TransparentIdentifier0.s)
    .Select(result => result.Count())
    .Count()

And that makes sense. But it would be nice to have legal C# identifiers for the lambda parameters.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions