CSharpFeeds - All your C# feeds in one place.

Tuesday, October 27, 2009

Implementing IEnumerable and IEnumerator

by Brendan Enrick via Brendan Enrick on 10/27/2009 2:00:00 PM

Working with a foreach loop is the primary reason to implement the IEnumerable and IEnumerator interfaces. You’ll want one of each of these to work with the loop. I am going to do an example DateRange class which will implement IEnumerable<DateTime> and will allow us to iterate through a non-existent collection of DateTime objects. Note: I am aware of the fact that I could achieve the same result with a for loop. I find the foreach loop more readable. First we need to create a basic Da ...

[ read more ]

Subscribe

New Feed

Product Spotlight

Recently Updated Sources

Legal Note

The content of the postings is owned by the respective author. CSharpFeeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on CSharpFeeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.

Advertise with us