Share via


ContextLinkCollection.GetEnumerator Method

Returns an object that both implements the Systems.Collections.IEnumerator interface and can iterate through the ContextLink objects within the ContextLinkCollection.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink.Analysis (in Microsoft.Ink.Analysis.dll)

Syntax

'Declaration
Public Function GetEnumerator As ContextLinkCollection.ContextLinkCollectionEnumerator
'Usage
Dim instance As ContextLinkCollection 
Dim returnValue As ContextLinkCollection.ContextLinkCollectionEnumerator 

returnValue = instance.GetEnumerator()
public ContextLinkCollection.ContextLinkCollectionEnumerator GetEnumerator()
public:
ContextLinkCollection.ContextLinkCollectionEnumerator^ GetEnumerator()
public function GetEnumerator() : ContextLinkCollection.ContextLinkCollectionEnumerator

Return Value

Type: Microsoft.Ink.ContextLinkCollection.ContextLinkCollectionEnumerator
An object that both implements the Systems.Collections.IEnumerator interface and can iterate through the ContextLink objects within the ContextLinkCollection.

Examples

The following examples show two ways to iterate over a ContextLinkCollection, links, and put all the ContextLink objects into an an ArrayList.

This example gets the Systems.Collections.IEnumerator for the ContextLinkCollection, links.

Dim customLinks As New ArrayList()
' Version using GetEnumerator() 
Dim enumerator As ContextLinkCollection.ContextLinkCollectionEnumerator = _
    links.GetEnumerator()
enumerator.Reset()
While enumerator.MoveNext()
    Dim aLink As ContextLink = CType(enumerator.Current, ContextLink)
    customLinks.Add(aLink)
End While
ArrayList customLinks = new ArrayList();
// Version using GetEnumerator()
ContextLinkCollection.ContextLinkCollectionEnumerator
    enumerator = links.GetEnumerator();
enumerator.Reset();
while (enumerator.MoveNext())
{
    ContextLink aLink = ((ContextLink)enumerator.Current);
    customLinks.Add(aLink);
}

This example uses the foreach statement, which calls the GetEnumerator method in internal code that the compiler generates to support the statement.

' Version using foreach 
Dim link As ContextLink
For Each link In links
    customLinks.Add(link)
Next link
// Version using foreach 
foreach (ContextLink link in links)
{
    customLinks.Add(link);
}

Platforms

Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

ContextLinkCollection Class

ContextLinkCollection Members

Microsoft.Ink Namespace