lass ListBox
{
public IEnumerator<string> GetEnumerator
{
foreach(string s in strings)
{
yeild return s;
}
}
}
foreach(string s in ListBox)
Console.WriteLine("{0}",s);
These are a few lines of code from the book "Learning C# 2005".Please explain how the IEnumerator is actually called and implemented here.
Thank you.
This post has been edited by tlhIn`toq: 03 October 2012 - 01:06 PM
Reason for edit:: code tags added

New Topic/Question
Reply



MultiQuote






|