Mega Code Archive

 
Categories / C# / Windows
 

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