ValidatorCollection.GetEnumerator Metoda

Definicja

IEnumerator Zwraca wystąpienie kolekcjiValidatorCollection.

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

Zwraca

IEnumerator

Element IEnumerator dla kolekcji.

Implementuje

Przykłady

Poniższy przykład kodu pokazuje użycie 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

Uwagi

Użyj tej metody, aby utworzyć System.Collections.IEnumerator wystąpienie, które można iterować za pomocą łatwego pobierania każdego elementu w kolekcji ValidatorCollection .

Dotyczy

Zobacz też