Freigeben über


ValidatorCollection.GetEnumerator-Methode

Gibt eine IEnumerator-Instanz für die ValidatorCollection-Auflistung zurück.

Namespace: System.Web.UI
Assembly: System.Web (in system.web.dll)

Syntax

'Declaration
Public Function GetEnumerator As IEnumerator
'Usage
Dim instance As ValidatorCollection
Dim returnValue As IEnumerator

returnValue = instance.GetEnumerator
public IEnumerator GetEnumerator ()
public:
virtual IEnumerator^ GetEnumerator () sealed
public final IEnumerator GetEnumerator ()
public final function GetEnumerator () : IEnumerator

Rückgabewert

Der IEnumerator für die Auflistung.

Hinweise

Mit dieser Methode können Sie eine System.Collections.IEnumerator-Instanz erstellen, die schnell durchlaufen werden kann, um alle Elemente in der ValidatorCollection-Auflistung abzurufen.

Beispiel

Im folgenden Codebeispiel wird die Verwendung der GetEnumerator-Methode veranschaulicht.

' 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
// 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.
ValidatorCollection myCollection = get_Validators();

// Get the Enumerator.
IEnumerator myEnumerator = myCollection.GetEnumerator();
// Print the values in the ValidatorCollection.
String myStr = " ";
while (myEnumerator.MoveNext()) {
    myStr += System.Convert.ToString(myEnumerator.get_Current());
    myStr += " ";
}
messageLabel.set_Text(myStr);

Plattformen

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

ValidatorCollection-Klasse
ValidatorCollection-Member
System.Web.UI-Namespace
IEnumerator