Skip to content

[C# Feature] Convenient combination of foreach and LINQ #1938

@dsaf

Description

@dsaf

I would argue that embedded is a better term for how the syntax feels at the moment.

Currently:

foreach (var item in from xItem in new[] {"One", "Two", "Three" } 
                     where xItem == "Two"
                     select xItem)
{
    Debug.WriteLine(item);
}

Suggested:

foreach (from item in new[] {"One", "Two", "Three" } 
         where item == "Two"
         select item)
{
    Debug.WriteLine(item.ToString());
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions