Share via


ContextLinkCollection.GetEnumerator Method

Returns an object that implements the [Systems.Collections.IEnumerator] interface and can iterate through the ContextLink objects in the ContextLinkCollection.

Namespace:  System.Windows.Ink
Assembly:  IAWinFX (in IAWinFX.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: System.Windows.Ink.ContextLinkCollection.ContextLinkCollectionEnumerator
An object that implements the [Systems.Collections.IEnumerator] interface and can iterate through the ContextLink objects in the ContextLinkCollection.

Examples

The following examples show two ways to iterate through a ContextLinkCollection named links, putting all custom links into an ArrayList named customLinks.

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()
While enumerator.MoveNext()
    Dim link 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 
For Each link As ContextLink In links
Next link
' Perform some action with each ContextLink.
// Version using foreach 
foreach (ContextLink link in links)
{
    // Perform some action with each ContextLink.
}

Platforms

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

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

System.Windows.Ink Namespace