I have created this code but trying to add some more function to it
public static int HowManyCores()
{
int CoresNumber = Environment.ProcessorCount;
try
{
return CoresNumber;
}
catch
{
return CoresNumber = 2;
}
}
I want the function to return "2" if it failed for any reason. Also I would like to return CoresNumber -1 (So if it finds 4 it returns 3) also another case: if CoresNumer less than 2 (Including) return 2.