using System;
using System.Collections.Generic;
class MyClass {
T[] array;
public MyClass(T[] a) {
array = a;
}
public IEnumerator GetEnumerator() {
foreach(T obj in array)
yield return obj;
}
}
class MainClass {
public static void Main() {
int[] nums = { 4, 3, 6, 4, 7, 9 };
MyClass mc = new MyClass(nums);
foreach(int x in mc)
Console.Write(x + " ");
Console.WriteLine();
bool[] bVals = { true, true, false, true };
MyClass mc2 = new MyClass(bVals);
foreach(bool b in mc2)
Console.Write(b + " ");
Console.WriteLine();
}
}
4 3 6 4 7 9
True True False True