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: System.Windows.Ink
Assembly: IAWinFX (in iawinfx.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.IEnumerator interface and can iterate through the ContextLink objects within the ContextLinkCollection.
Example
The following examples show two ways to iterate through a ContextLinkCollection, links
, and put all the custom links into an ArrayList, 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 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
System.Windows.Ink Namespace