All Posts assertfail

View the Blog on GitHub wallymathieu

IEnumerator love

14 Nov 2012

Some times you encounter a class that implements IEnumerator without any IEnumerable implementation. To preserve the spirit of the enumerator (basically a cursor) we can just add an extension method that yields the elements.

But most of the time it’s simply to add a “.Cast()" if it is IEnumerable without the extra type information.<div style="clear: both;"></div>


  • c#
  • Comments or errors? Fork post and do a pull request on github