The following proposal's value may be really low, nothing revolutionary, but sometimes one may need the code like the following:
// bar is an IEnumerable<T>
foreach ( var foo : bar ) {
Console.WriteLine(foo);
} else {
Console.WriteLine("no foos in the bar");
}
Just a little syntax sugar.
EDIT
Please note that there would be no a straightforward extension method: foreach might contain break, continue and return.
The following proposal's value may be really low, nothing revolutionary, but sometimes one may need the code like the following:
Just a little syntax sugar.
EDIT
Please note that there would be no a straightforward extension method: foreach might contain
break,continueandreturn.