Initialize a ManagementClass and list its methods : ManagementClass « Windows « C# / C Sharp






Initialize a ManagementClass and list its methods

  


using System;
using System.Management;

public class Sample 
{    
    public static void Main() 
    {

        // Get the WMI class
        ManagementClass c = new ManagementClass("Win32_LogicalDisk");

        // Get the methods in the class
        MethodDataCollection methods = c.Methods;

        // display the methods
        Console.WriteLine("Method Names: ");
        foreach (MethodData method in methods)
        {
            Console.WriteLine(method.Name);
        }


    }
}

   
    
  








Related examples in the same category

1.Enumerate ManagementClass
2.Initialize a ManagementClass and Get the properties in the class
3.Initialize a ManagementClass and Get the Qualifiers in the class
4.Create ManagementObjectSearcher to query Win32_Service