Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: 从 C# 中的矩形数组中提取一维数组的最佳方法是什么?
如何将矩形阵列复制到标准阵列?当然没有迭代每个项目......
double[,] rectArray = new double[3,3]; double[] linearArray = new array[9];
您可以使用OfTypeorCast方法:
OfType
Cast
linearArray = rectArray.OfType<double>().ToArray();
或者:
linearArray = rectArray.Cast<double>().ToArray();