Information Technology Reference
In-Depth Information
public void Reset() // Reset
{ Position = -1; }
}
class MyColors: IEnumerable {
string[] Colors = { "Red", "Yellow", "Blue" };
public IEnumerator GetEnumerator()
{ return new ColorEnumerator(Colors); }
}
class Program {
static void Main() {
MyColors mc = new MyColors();
foreach (string color in mc)
Console.Write("{0} ", color);
Console.WriteLine("");
}
}
}
This code produces the following output:
Red Yellow Blue
Search WWH ::




Custom Search