Whenever you allocate a new array in C# with
new T[length]
the array entries are set to the default of T. That is null for th
null
I suggest using Array.Fill as a very succint way to fill an array with an initial value:
Array.Fill
bool[] isPrime = new bool[MaxNum]; Array.Fill(isPrime, true);
This initializes all values in the isPrime array to true.
isPrime
true