Path Property
Collapse the table of content
Expand the table of content

ManagementClass.Path Property

 

Gets or sets the path of the WMI class to which the ManagementClass object is bound.

Namespace:   System.Management
Assembly:  System.Management (in System.Management.dll)

public override ManagementPath Path { get; set; }

Property Value

Type: System.Management.ManagementPath

The path of the object's class.

When the property is set to a new value, the ManagementClass will be disconnected from any previously-bound WMI class. Reconnect to the new WMI class path.

Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.

The following example shows how to initialize a ManagementClass variable with a ManagementClass constructor and then get all the methods in the WMI class passed into the constructor.

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;
    }
}

.NET Framework
Available since 1.1
Return to top
Show:
© 2016 Microsoft