How does the following code work? It gives the answer how I want. But I want to know how it works? C
- by user338096
public static void ShutDownComputer()
{
ManagementBaseObject outParameter = null;
ManagementClass sysOs = new ManagementClass("Win32_OperatingSystem");
sysOs.Get();
sysOs.Scope.Options.EnablePrivileges = true;
ManagementBaseObject inParameter = sysOs.GetMethodParameters("Win32Shutdown");
inParameter["Flags"] = "8";
inParameter["Reserved"] = "0";
foreach (ManagementObject maObj in sysOs.GetInstances())
{
outParameter = maObj.InvokeMethod("Win32Shutdown", inParameter, null);
}
}