Поделиться через


Process.Collection Property

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.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Syntax

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

Property Value

Type: EnvDTE.Processes
A Processes collection.

Examples

The following example demonstrates how to use the Collection property.

To test this property

  • Open the target project and run the add-in.
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 Security

See Also

Reference

Process Interface

EnvDTE Namespace

Other Resources

How to: Compile and Run the Automation Object Model Code Examples