ValidatorCollection.GetEnumerator Method

Definition

Returns an IEnumerator instance for the ValidatorCollection collection.

public System.Collections.IEnumerator GetEnumerator ();

Returns

The IEnumerator for the collection.

Implements

Examples

The following code example demonstrates using the GetEnumerator method.

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

Remarks

Use this method to create an System.Collections.IEnumerator instance that can be iterated through easily to get each item in the ValidatorCollection collection.

Applies to

Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also