I have a class:
public class ComplexNumber
{
public ComplexNumber()
{
this.Real = 0;
this.Imaginary= 0;
}
double Real;
double Imaginary;
(other stuff)
}
I have another class:
public class Test
{
Private void MyMethod
{
Blah, Blah, ...
ComplexNumber[,] result = new ComplexNumber[m + 1, n + 1];
string str = result[100, 50].ToString(); //Here
(Other stuff)
}
}
Inspecting result at the line with the "Here" comment I see that all of the
array elements are null. I can loop constructors for every array element but
I am wondering why the class default constructor does not do this for me when
I make the aray. Is there a better way to initialize the "result" array. I
tried result.Initialize(); but that didn't work.