Archive

Posts Tagged ‘Loop’

Suggestion: add optional “where” clause to “foreach” statement in C#

Wouldn’t it be nice if I could use in C# the following syntax?

for (SomeType repeaterVariable

      in SomeEnumerable

      where someBooleanExpressionOfRepeaterVariable)

  doSomethingUsingRepeaterVariable;

e.g. use this one:

image

instead of this one:

image

BTW, if you wonder what FixTime does, it prepends 0: to time strings to make sure they are of format h:m:s.f

Have added this as a comment to another person’s suggestion that I see has similar format, so please vote for that one:

https://visualstudio.uservoice.com/forums/121579-visual-studio-2015/suggestions/7474789-add-condition-to-foreach-in-statement

Advertisements
Categories: Posts Tags: , , , , ,
%d bloggers like this: