Share via


ContextLinkCollection.GetEnumerator Method

Returns an object that both implements the Systems.Collections.IEnumeratorSystems.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 ContextLinkCollectionEnumerator
'Usage
Dim instance As ContextLinkCollection
Dim returnValue As ContextLinkCollectionEnumerator

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

Return Value

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

Example

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

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

Dim customLinks As New ArrayList()
' Version using GetEnumerator()
Dim enumerator As ContextLinkCollection.ContextLinkCollectionEnumerator = _
    links.GetEnumerator()
While enumerator.MoveNext()
    Dim aLink As ContextLink = CType(enumerator.Current, ContextLink)
    ' Perform some action with each ContextLink.
End While
ArrayList customLinks = new ArrayList();
// Version using GetEnumerator()
ContextLinkCollection.ContextLinkCollectionEnumerator
    enumerator = links.GetEnumerator();
while (enumerator.MoveNext())
{
    ContextLink link =
        ((ContextLink)enumerator.Current);

    // Perform some action with each ContextLink.
 }

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
    ' Perform some action with each ContextLink.
Next link
// Version using foreach
foreach (ContextLink link in links)
{
    // Perform some action with each ContextLink.
}

Platforms

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

ContextLinkCollection Class
ContextLinkCollection Members
Microsoft.Ink Namespace