ValidatorCollection.GetEnumerator メソッド

定義

IEnumerator コレクションの ValidatorCollection インスタンスを返します。Returns an IEnumerator instance for the ValidatorCollection collection.

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

戻り値

コレクションの IEnumeratorThe IEnumerator for the collection.

実装

次のコード例は、メソッドGetEnumeratorの使用方法を示しています。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;
' 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

注釈

このメソッドを使用してSystem.Collections.IEnumeratorValidatorCollectionコレクション内の各項目を取得するために簡単に反復処理できるインスタンスを作成します。Use this method to create an System.Collections.IEnumerator instance that can be iterated through easily to get each item in the ValidatorCollection collection.

適用対象

こちらもご覧ください