共用方式為


Process.Collection 屬性

傳回包含此物件的集合,該物件可支援此屬性或是位在此程式碼建構中。 如果物件並非從集合取得,則會傳回 null。

命名空間:  EnvDTE
組件:  EnvDTE (在 EnvDTE.dll 中)

語法

'宣告
ReadOnly Property Collection As Processes
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 命名空間

其他資源

HOW TO:編譯和執行 Automation 物件模型程式碼範例