DataListItemCollection.GetEnumerator 方法

定义

返回包含 IEnumerator 中的所有 DataListItem 对象的 DataListItemCollection 接口。Returns a IEnumerator interface that contains all DataListItem objects in the DataListItemCollection.

public:
 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 中的所有 DataListItem 对象的 DataListItemCollection 接口。A IEnumerator interface that contains all DataListItem objects in the DataListItemCollection.

实现

注解

使用此方法创建一个System.Collections.IEnumerator可以轻松地循环访问以获取集合中的DataListItemCollection每个项的。Use this method to create a System.Collections.IEnumerator that can be easily iterated through to get each item in the DataListItemCollection 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 back to the initial position.

备注

创建System.Collections.IEnumerator对象或IEnumerator.Reset使用方法将枚举数移到集合中的第一项后IEnumerator.MoveNext , 必须调用方法。After you create a System.Collections.IEnumerator 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.

适用于

另请参阅