Thursday, March 29, 2012

Please give me an example of IEnumerable and IEnumerator use

Good day
Could you please give me an example of IEnumerable implementation on some simple class? (plus the definition of IEnumerator).

I can implement the IEnumerable and return some enumerator but I can't imagine how some enumerator can walk through collection in another class. How does the enumerator gain access to it?
Ifyou have any idea, please share it with me.
Thanks, HookerThe C# docs give a really good example

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vcwlkforeachtutorial.asp

VB version here:

http://support.microsoft.com/?kbid=322025

0 comments:

Post a Comment