Udostępnij za pośrednictwem


Process.Collection Property

Definition

Returns the collection that contains the object that supports this property or is contained in this code construct. Returns null for an object that is not obtained from a collection.

public:
 property EnvDTE::Processes ^ Collection { EnvDTE::Processes ^ get(); };
[System.Runtime.InteropServices.DispId(202)]
public EnvDTE.Processes Collection { [System.Runtime.InteropServices.DispId(202)] get; }
[<System.Runtime.InteropServices.DispId(202)>]
[<get: System.Runtime.InteropServices.DispId(202)>]
member this.Collection : EnvDTE.Processes
Public ReadOnly Property Collection As Processes

Property Value

A Processes collection.

Attributes

Examples

The following example demonstrates how to use the Collection property.

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  

Applies to