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