ValidatorCollection.GetEnumerator Metoda

Definice

IEnumerator Vrátí instanci kolekceValidatorCollection.

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

Návraty

IEnumerator

Kolekce je určena IEnumerator .

Implementuje

Příklady

Následující příklad kódu ukazuje použití GetEnumerator metody.

// Get 'Validators' of the page to myCollection.
ValidatorCollection myCollection = Page.Validators;

// Get the Enumerator.
IEnumerator myEnumerator = myCollection.GetEnumerator();
// Print the values in the ValidatorCollection.
string myStr = " ";
while ( myEnumerator.MoveNext() )
{
   myStr += myEnumerator.Current.ToString();
   myStr += " ";
}
messageLabel.Text = myStr;
' Get 'Validators' of the page to myCollection.
Dim myCollection As ValidatorCollection = Page.Validators
' Get the Enumerator.
Dim myEnumerator As IEnumerator = myCollection.GetEnumerator()
' Print the values in the ValidatorCollection.
Dim myStr As String = " "
While myEnumerator.MoveNext()
   myStr += myEnumerator.Current.ToString()
   myStr += " "
End While
messageLabel.Text = myStr

Poznámky

Tuto metodu System.Collections.IEnumerator použijte k vytvoření instance, kterou lze snadno itestrovat, abyste získali každou položku v kolekci ValidatorCollection .

Platí pro

Viz také