Tag Archives: extension methods

“Until” extension method for integers in C#

I wrote this simple snippet today, and thought I’d share: public static IEnumerable<int> Until(this int from, int to) { for (int i = from; i <= to; i++) { yield return i; } } Its purpose is to return number … Continue reading

Posted in C# | Tagged , | Leave a comment

Extending C# Enumerators with Methods

Although I personally find C# enumerators to be atrocious, they still have several advantages over constant integers.  One of these advantages is the ability to extend the object with additional logic.  This is accomplished by binding extension methods at compile … Continue reading

Posted in C# | Tagged , , | Leave a comment