Can we initialize an array of double[][][] as double[1][2][3] (this is not the correct syntax) using linq.
using for loop one way is
double[][][] myarr = new double[1][][];
for(int i=0; i<1; i++)
{
myarr[i] = new double[2][];
for(int j=0; j<2; j++)
{
myarr[i][j] = new double[3];
}
}
but i want a cleaner code. I tried Select but it only fills first level. How to go about it. Thanks
& btw this is not homework!!
But this requires multiple
ToArray()calls which doing memory copy (see implementaiton below) so for big number of items it would not be efficient so such kind of “elegant” solution is not for free. BTW, I would preferforloop solution.Enumerable.ToArray()implementation: (credits to ILSpy)