C# program to get the total number of cores on a computer

CsharpProgrammingServer Side Programming

Use the Environment.ProcessorCount to get the total number of cores on a computer −

Environment.ProcessorCount

The following is the code that displays the total number of cores on a computer in C# −

Example

Using System;
namespace Demo {
   class Program {
      static void Main(string[] args) {
         Console.WriteLine(Environment.ProcessorCount);
      }
   }
}
raja
Published on 05-Sep-2018 15:11:30
Advertisements