Partager via


ContextLinkBaseCollection.GetEnumerator, méthode

Mise à jour : November 2007

Retourne un objet qui implémente l'interface IEnumerator et parcourir les objets ContextLinkBase contenus dans le ContextLinkBaseCollection.

Espace de noms :  System.Windows.Ink.AnalysisCore
Assembly :  IACore (dans IACore.dll)

Syntaxe

'Déclaration
Public Function GetEnumerator As ContextLinkBaseCollection..::.ContextLinkBaseCollectionEnumerator
'Utilisation
Dim instance As ContextLinkBaseCollection
Dim returnValue As ContextLinkBaseCollection..::.ContextLinkBaseCollectionEnumerator

returnValue = instance.GetEnumerator()
public ContextLinkBaseCollection..::.ContextLinkBaseCollectionEnumerator GetEnumerator()
public:
ContextLinkBaseCollection..::.ContextLinkBaseCollectionEnumerator^ GetEnumerator()
public ContextLinkBaseCollection..::.ContextLinkBaseCollectionEnumerator GetEnumerator()
public function GetEnumerator() : ContextLinkBaseCollection..::.ContextLinkBaseCollectionEnumerator

Valeur de retour

Type : System.Windows.Ink.AnalysisCore.ContextLinkBaseCollection.ContextLinkBaseCollectionEnumerator
Objet qui implémente l'interface IEnumerator et peut parcourir les objets ContextLinkBase contenus dans le ContextLinkBaseCollection.

Exemples

Les exemples de cette section présentent deux façons de parcourir un ContextLinkBaseCollection nommé links en collectant tous les liens personnalisés.

L'exemple suivant obtient le IEnumerator pour le ContextLinkBaseCollection nommé links.

Dim customLinks As New ArrayList()
' Version using GetEnumerator()
Dim enumerator As _
    ContextLinkBaseCollection.ContextLinkBaseCollectionEnumerator = links.GetEnumerator()
While enumerator.MoveNext()
    Dim aLink As ContextLinkBase = CType(enumerator.Current, ContextLinkBase)
    ' Perform some action with each ContextLinkBase.

End While
ArrayList customLinks = new ArrayList();
// Version using GetEnumerator()
ContextLinkBaseCollection.ContextLinkBaseCollectionEnumerator
    enumerator = links.GetEnumerator();
while (enumerator.MoveNext())
{
    ContextLinkBase link =
        ((ContextLinkBase)enumerator.Current);

    // Perform some action with each ContextLinkBase.
}

L'exemple suivant utilise l'instruction foreach, qui appelle la méthode GetEnumerator dans le code interne que le compilateur génère pour prendre en charge l'instruction.

' Version using foreach
Dim link As ContextLinkBase
For Each link In links
    ' Perform some action with each ContextLinkBase.
Next link
// Version using foreach
foreach (ContextLinkBase link in links)
{
    // Perform some action with each ContextLink.
}

Plateformes

Windows Vista, Windows XP SP2, Windows Server 2003

Le .NET Framework et le .NET Compact Framework ne prennent pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.

Informations de version

.NET Framework

Pris en charge dans : 3.0

Voir aussi

Référence

ContextLinkBaseCollection, classe

Membres ContextLinkBaseCollection

System.Windows.Ink.AnalysisCore, espace de noms