次の方法で共有


Recognizers.GetEnumerator メソッド

System.Collections.IEnumerator インターフェイスを実装するオブジェクトを返します。このオブジェクトを使用すると、Recognizers コレクション内の Recognizer オブジェクトを反復処理できます。

名前空間 :  Microsoft.Ink
アセンブリ :  Microsoft.Ink (Microsoft.Ink.dll 内)

構文

'宣言
Public Function GetEnumerator As Recognizers..::.RecognizersEnumerator
'使用
Dim instance As Recognizers
Dim returnValue As Recognizers..::.RecognizersEnumerator

returnValue = instance.GetEnumerator()
public Recognizers..::.RecognizersEnumerator GetEnumerator()
public:
Recognizers..::.RecognizersEnumerator^ GetEnumerator()
public Recognizers..::.RecognizersEnumerator GetEnumerator()
public function GetEnumerator() : Recognizers..::.RecognizersEnumerator

戻り値

型 : Microsoft.Ink.Recognizers.RecognizersEnumerator
System.Collections.IEnumerator インターフェイスを実装するオブジェクトを返します。このオブジェクトを使用すると、Recognizers コレクション内の Recognizer オブジェクトを反復処理できます。

これらの例では、Recognizers コレクションをスキャンし、Recognizers オコレクションの各 Recognizer オブジェクトの名前を取得する 2 つの方法を示します。

この例では、Recognizers コレクション用に System.Collections.IEnumerator を取得し、これを使用してコレクションをスキャンします。

' calling the constructor fills the collection with all known Recognizer objects
Dim allRecognizers As Recognizers = New Recognizers()
Dim recogNames As List(Of String) = New List(Of String)
Dim theEnumerator As IEnumerator = allRecognizers.GetEnumerator()
theEnumerator.Reset()
While (theEnumerator.MoveNext())
    Dim theRecognizer As Recognizer = DirectCast(theEnumerator.Current, Recognizer)
    recogNames.Add(theRecognizer.Name)
End While
// calling the constructor fills the collection with all known Recognizer objects
Recognizers allRecognizers = new Recognizers();
List<String> recogNames = new List<string>();
IEnumerator theEnumerator = allRecognizers.GetEnumerator();
theEnumerator.Reset();
while (theEnumerator.MoveNext())
{
    Recognizer theRecognizer = (Recognizer)theEnumerator.Current;
    recogNames.Add(theRecognizer.Name);
}

この例では、foreach ステートメント (Visual Basic の場合は For Each) を使用します。このステートメントは、ステートメントをサポートするためにコンパイラが生成する内部コードで、GetEnumerator メソッドを呼び出します。

' calling the constructor fills the collection with all known Recognizer objects
Dim allRecognizers As Recognizers = New Recognizers()
Dim recogNames As List(Of String) = New List(Of String)
For Each theRecognizer As Recognizer In allRecognizers
    recogNames.Add(theRecognizer.Name)
Next
// calling the constructor fills the collection with all known Recognizer objects
Recognizers allRecognizers = new Recognizers();
List<String> recogNames = new List<string>();
foreach (Recognizer theRecognizer in allRecognizers)
{
    recogNames.Add(theRecognizer.Name);
}

プラットフォーム

Windows Vista

.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。

バージョン情報

.NET Framework

サポート対象 : 3.0

参照

参照

Recognizers クラス

Recognizers メンバ

Microsoft.Ink 名前空間

Recognizer