dotnet/csharplang

Feature Request: Recursively Foreach

wisamidris7 opened this issue · 0 comments

I know this is looks crazy idea but it will be very good for c# cause in dart now it contains recursively foreach
So can c# have recursively foreach to make it very easy

It could be like this

foreach (var item in Items; var level = 0; var children = item.Children)
{
     Console.WriteLine("We are in level " + level);
     Console.WriteLine("We are in item" + item.Name);
     Console.WriteLine("We are in my children count" + children?.Count() ?? 0);
}

This is the best thing i think with if you can make a different or easier one it's okay but that what i think will be awesome