Freigeben über


Process.Collection-Eigenschaft

Gibt die Auflistung mit dem Objekt zurück, das diese Eigenschaft unterstützt oder das in diesem Codekonstrukt enthalten ist.Gibt NULL für ein Objekt zurück, das nicht aus einer Auflistung abgerufen wird.

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

Eigenschaftswert

Typ: EnvDTE.Processes
Eine Processes-Auflistung.

Beispiele

Im folgenden Beispiel wird veranschaulicht, wie die Collection-Eigenschaft verwendet wird.

So testen Sie diese Eigenschaft

  • Öffnen Sie das Zielprojekt, und führen Sie das Add-In aus.
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-Sicherheit

Siehe auch

Referenz

Process Schnittstelle

EnvDTE-Namespace

Weitere Ressourcen

Gewusst wie: Kompilieren und Ausführen der Codebeispiele für das Automatisierungsobjektmodell