obtain generic enumerator from an array

前端 未结 7 1251
感情败类
感情败类 2020-12-08 12:23

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

7条回答
  •  广开言路
    2020-12-08 13:22

    YourArray.OfType().GetEnumerator();

    may perform a little better, since it only has to check the type, and not cast.

提交回复
热议问题