RecognitionAlternates.GetEnumerator 方法
返回一个对象,该对象实现 System.Collections.IEnumerator 接口,该接口可以循环访问 RecognitionAlternates 集合中的 RecognitionAlternate 对象。
命名空间: Microsoft.Ink
程序集: Microsoft.Ink(在 Microsoft.Ink.dll 中)
语法
声明
Public Function GetEnumerator As RecognitionAlternates..::.RecognitionAlternatesEnumerator
用法
Dim instance As RecognitionAlternates
Dim returnValue As RecognitionAlternates..::.RecognitionAlternatesEnumerator
returnValue = instance.GetEnumerator()
public RecognitionAlternates..::.RecognitionAlternatesEnumerator GetEnumerator()
public:
RecognitionAlternates..::.RecognitionAlternatesEnumerator^ GetEnumerator()
public RecognitionAlternates..::.RecognitionAlternatesEnumerator GetEnumerator()
public function GetEnumerator() : RecognitionAlternates..::.RecognitionAlternatesEnumerator
返回值
类型:Microsoft.Ink.RecognitionAlternates.RecognitionAlternatesEnumerator
返回一个对象,该对象实现 System.Collections.IEnumerator 接口,该接口可以循环访问 RecognitionAlternates 集合中的 RecognitionAlternate 对象。
示例
这些示例演示通过两种方式来遍历 RecognitionAlternates 集合,并将集合中包含的每个 RecognitionAlternate 对象的字符串表示形式都添加到一个泛型字符串列表中。
此示例获取 RecognitionAlternates 集合的 System.Collections.IEnumerator,然后使用它遍历该集合。
Dim inkRecogAlternates As List(Of String) = New List(Of String)
' get the RecognitionAlternates from the RecognitionResult object
Dim mAlternates As RecognitionAlternates = mRecognitionResult.GetAlternatesFromSelection()
' get the enumerator
Dim iEnum As RecognitionAlternates.RecognitionAlternatesEnumerator = mAlternates.GetEnumerator()
iEnum.Reset()
' traverse the collection
While iEnum.MoveNext()
Dim theRecognitionAlternate As RecognitionAlternate = iEnum.Current
inkRecogAlternates.Add(theRecognitionAlternate.ToString())
End While
List<String> inkRecogAlternates = new List<string>();
// get the RecognitionAlternates from the RecognitionResult object
RecognitionAlternates mAlternates = mRecognitionResult.GetAlternatesFromSelection();
// get the enumerator
RecognitionAlternates.RecognitionAlternatesEnumerator iEnum = mAlternates.GetEnumerator();
iEnum.Reset();
// traverse the collection
while (iEnum.MoveNext())
{
RecognitionAlternate theRecognitionAlternate = iEnum.Current;
inkRecogAlternates.Add(theRecognitionAlternate.ToString());
}
此示例使用 foreach 语句(在 Visual Basic 中为 For Each),该语句仅调用内部代码中的 GetEnumerator 方法,该方法是编译器为支持此语句而生成的。
Dim inkRecogAlternates As List(Of String) = New List(Of String)
' get the RecognitionAlternates from the RecognitionResult object
Dim mAlternates As RecognitionAlternates = mRecognitionResult.GetAlternatesFromSelection()
' traverse the collection
For Each theRecognitionAlternate As RecognitionAlternate In mAlternates
inkRecogAlternates.Add(theRecognitionAlternate.ToString())
Next
List<String> inkRecogAlternates = new List<string>();
// get the RecognitionAlternates from the RecognitionResult object
RecognitionAlternates mAlternates = mRecognitionResult.GetAlternatesFromSelection();
// traverse the collection
foreach (RecognitionAlternate theRecognitionAlternate in mAlternates)
{
inkRecogAlternates.Add(theRecognitionAlternate.ToString());
}
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
版本信息
.NET Framework
受以下版本支持:3.0