//do something 3 times 3.Times().Do(i=>Console.WriteLine("Sometext")); //count an integer from 3 to 8 (both included) and do some action for each value. 3.To(8).Do(i=>Console.WriteLine("The number is: " + i ))
I know this is sort of thing is common in languages like Ruby or F# but that's not gonna stop me from doing it in C# :)
The implementation can be found at http://code.google.com/p/plain
Fun idea, but I'd have to say that a simple for loop is easy enough to read, and only a few extra keystrokes. In my opinion, if code could potentially be read by anyone else, I'd opt for simplicity and standard code.
ReplyDeleteHi Joe. I agree with you. Simplicity is the way to go. The question is how you define what is simple and how the programmers on your project define it. If you have introduced functional approaches like LINQ to your project I think this approach might be quite natural. I could be wrong. :)
ReplyDelete