次の方法で共有


ContextLinkCollection.GetEnumerator メソッド

[Systems.Collections.IEnumerator] インターフェイスを実装し、ContextLinkCollection 内の ContextLink オブジェクトを反復処理できるオブジェクトを返します。

名前空間 :  System.Windows.Ink
アセンブリ :  IAWinFX (IAWinFX.dll 内)

構文

'宣言
Public Function GetEnumerator As ContextLinkCollection..::.ContextLinkCollectionEnumerator
'使用
Dim instance As ContextLinkCollection
Dim returnValue As ContextLinkCollection..::.ContextLinkCollectionEnumerator

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

戻り値

型 : System.Windows.Ink.ContextLinkCollection.ContextLinkCollectionEnumerator
[Systems.Collections.IEnumerator] インターフェイスを実装し、ContextLinkCollection 内の ContextLink オブジェクトを反復処理できるオブジェクト。

次の例に、links という名前の ContextLinkCollection を反復処理し、すべてのカスタム リンクを customLinks という名前の ArrayList に配置する 2 つの方法を示します。

この例では、ContextLinkCollection、links の [Systems.Collections.IEnumerator] を取得します。

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.
}

この例では、foreach ステートメントを使用します。このステートメントは、ステートメントをサポートするためにコンパイラが生成する内部コードで、GetEnumerator メソッドを呼び出します。

' 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.
}

プラットフォーム

Windows Vista

.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。

バージョン情報

.NET Framework

サポート対象 : 3.0

参照

参照

ContextLinkCollection クラス

ContextLinkCollection メンバ

System.Windows.Ink 名前空間