次の方法で共有


Process.Collection プロパティ

このプロパティをサポートしているオブジェクトまたはこのコード コンストラクターに含まれているオブジェクトを含むコレクションを返します。 オブジェクトがコレクションから取得されない場合は null を返します。

名前空間:  EnvDTE
アセンブリ:  EnvDTE (EnvDTE.dll 内)

構文

'宣言
ReadOnly Property Collection As Processes
    Get
Processes Collection { get; }
property Processes^ Collection {
    Processes^ get ();
}
abstract Collection : Processes
function get Collection () : Processes

プロパティ値

型: EnvDTE.Processes
Processes コレクションを返します。

Collection プロパティの使用方法を次の例に示します。

このプロパティをテストするには

  • ターゲット プロジェクトを開き、アドインを実行します。
public static void Collection(DTE dte)
{
    // Setup debug Output window.
    Window w = (Window)dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
    w.Visible = true;
    OutputWindow ow = (OutputWindow)w.Object;
    OutputWindowPane owp = ow.OutputWindowPanes.Add("Collection Property Test");
    owp.Activate();

    EnvDTE.Process process = dte.Debugger.LocalProcesses.Item(1);
    owp.OutputString("Number of items in the process collection is " + 
        process.Collection.Count + ": ");
    foreach(EnvDTE.Process proc in process.Collection)
        owp.OutputString("\n" + proc.Name + "  ");
}
Shared Sub Collection(ByRef dte As EnvDTE.DTE)
    Dim process As EnvDTE.Process = dte.Debugger.LocalProcesses.Item(1)
    Dim str As String = vbCrLf
    str = "There are " + process.Collection.Count.ToString()
    str += " items in the process collection: "
    For Each proc As EnvDTE.Process In process.Collection
        str += vbCrLf + proc.Name + "  "
    Next
    MessageBox.Show(str, "Process Test - Collection Property")
End Sub

.NET Framework セキュリティ

  • 直前の呼び出し元に対する完全な信頼。 このメンバーは、部分的に信頼されているコードから使用することはできません。 詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

参照

Process インターフェイス

EnvDTE 名前空間

その他の技術情報

方法 : オートメーション オブジェクト モデルのコード例をコンパイルおよび実行する