DataGridItemCollection.GetEnumerator 方法


返回一个实现了 IEnumerator 的对象,该对象包含 DataGridItem 集合中的所有 DataGridItemCollection 对象。Returns a IEnumerator-implemented object that contains all the DataGridItem objects in the DataGridItemCollection collection.

 virtual System::Collections::IEnumerator ^ GetEnumerator();
public System.Collections.IEnumerator GetEnumerator ();
abstract member GetEnumerator : unit -> System.Collections.IEnumerator
override this.GetEnumerator : unit -> System.Collections.IEnumerator
Public Function GetEnumerator () As IEnumerator


一个实现了 IEnumerator 的对象,其中包含 DataGridItem 中的所有 DataGridItemCollection 对象。A IEnumerator-implemented object that contains all DataGridItem objects in the DataGridItemCollection.



使用此方法创建一个实现System.Collections.IEnumerator了的对象, 该对象可循环访问以获取集合中的DataGridItemCollection每一项。Use this method to create a System.Collections.IEnumerator-implemented object that can be iterated through to get each item in the DataGridItemCollection collection.

IEnumerator.Current使用属性可获取集合中当前指向的项。Use the IEnumerator.Current property to get the item currently pointed to in the collection.

IEnumerator.MoveNext使用方法移动到集合中的下一项。Use the IEnumerator.MoveNext method to move to the next item in the collection.

IEnumerator.Reset使用方法可将枚举器移动到其初始位置。Use the IEnumerator.Reset method to move the enumerator to its initial position.


创建System.Collections.IEnumerator实现的对象或IEnumerator.Reset使用方法将枚举数移到集合中的第一项后IEnumerator.MoveNext , 必须调用方法。After you create a System.Collections.IEnumerator-implemented object or use the IEnumerator.Reset method to move the enumerator to the first item in the collection, you must call the IEnumerator.MoveNext method. 否则, 由IEnumerator.Current属性表示的项是不确定的。Otherwise, the item represented by the IEnumerator.Current property is undefined.