Simon

Simon

  • NA
  • 11
  • 0

Arrays' initial value - how do you set it?!

Apr 16 2009 5:04 PM

Assume an array:

double[,] array = new double[x,y];

I know that the elements will be initialised to zero but I want to set every one of the array to a 'double.NaN'.

I did initially try a foreach loop, but the compiler complained. The only other way is two nested 'for' loops acting with x and y. Is there an easier way?


Answers (7)