Condividi tramite


ValidatorCollection.GetEnumerator Metodo

Definizione

Restituisce un'istanza IEnumerator per l'insieme ValidatorCollection.

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

Restituisce

IEnumerator

L'oggetto IEnumerator per l'insieme.

Implementazioni

Esempio

Nell'esempio di codice seguente viene illustrato l'uso del GetEnumerator metodo .

// 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

Commenti

Utilizzare questo metodo per creare un'istanza System.Collections.IEnumerator che può essere iterata facilmente per ottenere ogni elemento nella ValidatorCollection raccolta.

Si applica a

Vedi anche