ContextNodeCollection.GetEnumerator - метод
Обновлен: Ноябрь 2007
Returns an object that both implements the IEnumerator interface, and can iterate through the ContextNode objects within the ContextNodeCollection.
Пространство имен: Microsoft.Ink
Сборка: Microsoft.Ink.Analysis (в Microsoft.Ink.Analysis.dll)
Синтаксис
'Декларация
Public Function GetEnumerator As ContextNodeCollection..::.ContextNodeCollectionEnumerator
'Применение
Dim instance As ContextNodeCollection
Dim returnValue As ContextNodeCollection..::.ContextNodeCollectionEnumerator
returnValue = instance.GetEnumerator()
public ContextNodeCollection..::.ContextNodeCollectionEnumerator GetEnumerator()
public:
ContextNodeCollection..::.ContextNodeCollectionEnumerator^ GetEnumerator()
public ContextNodeCollection..::.ContextNodeCollectionEnumerator GetEnumerator()
public function GetEnumerator() : ContextNodeCollection..::.ContextNodeCollectionEnumerator
Возвращаемое значение
Тип: Microsoft.Ink.ContextNodeCollection.ContextNodeCollectionEnumerator
An object that both implements the IEnumerator interface, and can iterate through the ContextNode objects within the ContextNodeCollection.
Примеры
The examples in this section show two ways to iterate over a ContextNodeCollection and get the identifiers for all of the lines in an InkAnalyzer, theInkAnalyzer.
The following example gets the IEnumerator for the ContextNodeCollection, lines.
Dim ids As New ArrayList()
' Version using GetEnumerator()
Dim lines As ContextNodeCollection = _
theInkAnalyzer.FindNodesOfType(Microsoft.Ink.ContextNodeType.Line)
Dim ienum As IEnumerator = lines.GetEnumerator()
While ienum.MoveNext()
Dim id As Guid = CType(ienum.Current, ContextNode).Id
ids.Add(id)
End While
ArrayList ids = new ArrayList();
// Version using GetEnumerator()
ContextNodeCollection lines =
theInkAnalyzer.FindNodesOfType(Microsoft.Ink.ContextNodeType.Line);
IEnumerator ienum = lines.GetEnumerator();
while (ienum.MoveNext())
{
Guid id = ((ContextNode)ienum.Current).Id;
ids.Add(id);
}
The following example uses the foreach statement, which calls the GetEnumerator method in internal code generated by the compiler to support the statement.
' Version using foreach
Dim line As ContextNode
For Each line In lines
Dim id As Guid = line.Id
ids.Add(id)
Next line
// Version using foreach
foreach (ContextNode line in lines)
{
Guid id = line.Id;
ids.Add(id);
}
Платформы
Windows Vista
Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.
Сведения о версии
.NET Framework
Поддерживается в версии: 3.0