A Do() Extension Method to Replace Wordy For Loops

added by csurfleet
3/7/2012 6:14:08 AM

4 Kicks, 440 Views

I'm fast starting to view the foreach loop as a code smell - here is a little extension method to get rid of lots of those pesky loops!


1 comments

dpeterson
3/7/2012 11:21:30 AM
Do seems to be a keyword that languages can't agree upon. In Coffeescript/Ruby it provides a closure for a loop variable, here it just seems to be an alternative to the foreach keyword. I personally prefer to use foreach in the traditional sense, and leave do as a method to provide variable closure.