BindingContext.IEnumerable.GetEnumerator Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets an enumerator for the collection.
virtual System::Collections::IEnumerator ^ System.Collections.IEnumerable.GetEnumerator() = System::Collections::IEnumerable::GetEnumerator;
System.Collections.IEnumerator IEnumerable.GetEnumerator ();
abstract member System.Collections.IEnumerable.GetEnumerator : unit -> System.Collections.IEnumerator
override this.System.Collections.IEnumerable.GetEnumerator : unit -> System.Collections.IEnumerator
Function GetEnumerator () As IEnumerator Implements 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.
private:
void GetManagerEnumerator()
{
IEnumerator^ myEnumerator;
myEnumerator = ( (IEnumerable^)(this->BindingContext) )->GetEnumerator();
ForEachEnumerator();
}
void ForEachEnumerator()
{
for each ( IEnumerator^ myEnumerator in ( (IEnumerable^)(this->BindingContext) ) )
{
Console::WriteLine( myEnumerator );
}
}
private void GetManagerEnumerator(){
IEnumerator myEnumerator;
myEnumerator = ((IEnumerable)this.BindingContext).GetEnumerator();
ForEachEnumerator();
}
private void ForEachEnumerator(){
foreach( IEnumerator myEnumerator in this.BindingContext){
Console.WriteLine(myEnumerator.ToString());
}
}
Private Sub GetManagerEnumerator()
Dim myEnumerator As IEnumerator
myEnumerator = CType(BindingContext,IEnumerable).GetEnumerator()
ForEachEnumerator()
End Sub
Private Sub ForEachEnumerator()
Dim myEnumerator As IEnumerator
For Each myEnumerator In CType(BindingContext,IEnumerable)
Console.WriteLine(myEnumerator.Current.ToString())
Next
End Sub
Remarks
The IEnumerator returned by the IEnumerable.GetEnumerator method allows you to iterate over the collection managed by the BindingContext.
Applies to
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET