Język

ManagementClass.Path Właściwość

Definicja

Pobiera lub ustawia ścieżkę klasy WMI, do której ManagementClass jest powiązany obiekt.

public:
 virtual property System::Management::ManagementPath ^ Path { System::Management::ManagementPath ^ get(); void set(System::Management::ManagementPath ^ value); };
public override System.Management.ManagementPath Path { get; set; }
member this.Path : System.Management.ManagementPath with get, set
Public Overrides Property Path As ManagementPath

Wartość właściwości

Ścieżka klasy obiektu.

Przykłady

W poniższym przykładzie pokazano, jak zainicjować zmienną ManagementClassManagementClass za pomocą konstruktora, a następnie pobrać wszystkie metody w klasie WMI przekazane do konstruktora.

using System;
using System.Management;

public class Example
{
    public static void Main()
    {
        ManagementClass c = new ManagementClass();
        c.Path.ClassName = "Win32_Process";

        foreach (MethodData m in c.Methods)
            Console.WriteLine(
                "The class contains this method: {0}", m.Name);
        return;
    }
}
Imports System.Management

Public Class Sample

    Public Shared Function Main(ByVal args() _
        As String) As Integer

        Dim c As New ManagementClass
        c.Path.ClassName = "Win32_Process"

        Dim m As MethodData
        For Each m In c.Methods
            Console.WriteLine( _
                "The class contains the method : {0}", m.Name)
        Next m

        Return 0
    End Function
End Class

Uwagi

Gdy właściwość zostanie ustawiona na nową wartość, ManagementClass właściwość zostanie odłączona od dowolnej wcześniej powiązanej klasy WMI. Ponownie połącz się z nową ścieżką klasy WMI.

Zabezpieczenia programu .NET Framework

Pełne zaufanie dla bezpośredniego obiektu wywołującego. Tego elementu członkowskiego nie można używać przez częściowo zaufany kod. Aby uzyskać więcej informacji, zobacz Using Libraries from Partially Trusted Code (Używanie bibliotek z częściowo zaufanego kodu).

Dotyczy