C#: Is it possible to position a 2darray in a certain position in another 2darray without iterating through it?
Is it possible to position a 2d array in a certain position in another 2d array without iterating through it?开发者_运维百科
public double[,] array2D;
array2D = new double[7,7];
public void fill1D(double[,] values)
{
Array2D = values; //Values holds a 5x5 array that i wan't to place from 1,1 in array2D
}
Thanks
No you can't (edit: without copying) , I'm sorry. You could mimic this perhaps with the ArraySegement
(but you'd have to use a 1D base array. You may also care to read this paper that suggests plain rectangular arrays are relatively slow in C#.
精彩评论