将3-dim数组复制到11x3-dim数组中C#

时间:2015-09-20 10:49:39

标签: c# arrays loops copy

我有这个C#代码,它具有3-dim double,然后将其复制到11x3双:

var i = 8;
var temprate = new double[]{1,2,3};
var RATES = new double[11,3]

RATES[i, 0] = temprate[0];
RATES[i, 1] = temprate[1];
RATES[i, 2] = temprate[2];

如何直接将temprate复制到RATES中(最好没有循环)?

即:"RATES[i,*]=temprate"

1 个答案:

答案 0 :(得分:0)

Buffer.BlockCopy(temprate, 0, RATES, i * 3 * sizeof(double), 3 * sizeof(double));