In C#, how does one obtain a generic enumerator from a given array?
In the code below, MyArray is an array of MyType objects. I\'d like to
MyArray
MyType
Works on 2.0+:
((IEnumerable)myArray).GetEnumerator()
Works on 3.5+ (fancy LINQy, a bit less efficient):
myArray.Cast().GetEnumerator() // returns IEnumerator