Reputation: 97
I have already declared an array:
double[,] g_bessel = new double[2, 2];
And, I want to initialize it at another place:
{{1,2},{3,4}}
How can I initialize the matrix at a once and not cell by cell?
g_bessel = {{1,2},{3,4}};
Upvotes: 0
Views: 231
Reputation: 726
You must use operator "new" for initialize new array in this way.
g_besse = new double[,]{{1,2},{3,4}} ;
This code allocates new memory for array. If you need reinitialize this array many times, you can create custom method for change array's values.
Upvotes: 2