public static int GetNumberOfProcessors() { ManagementObject system = GetComputerSystem(); if (system != null) { object num = system.Properties["NumberOfProcessors"].Value; if (num != null) return Convert.ToInt32(num); } return 1; }