Прочетете на английски Редактиране

Споделяне чрез


BindingContext.IEnumerable.GetEnumerator Method

Definition

Gets an enumerator for the collection.

C#
System.Collections.IEnumerator IEnumerable.GetEnumerator();

Returns

An IEnumerator for the collection.

Implements

Examples

The following code example uses the IEnumerable.GetEnumerator method to return an IEnumerator for the BindingContext.

C#
private void GetManagerEnumerator(){
   IEnumerator myEnumerator;
   myEnumerator = ((IEnumerable)this.BindingContext).GetEnumerator();
   ForEachEnumerator();
}

private void ForEachEnumerator(){
   foreach( IEnumerator myEnumerator in this.BindingContext){
      Console.WriteLine(myEnumerator.ToString());
   }
}

Remarks

The IEnumerator returned by the IEnumerable.GetEnumerator method allows you to iterate over the collection managed by the BindingContext.

Applies to

Продукт Версии
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10