使用新的System.Memory Span 结构处理二维数组数据是否可行?
double[,] testMulti =
{
{ 1, 2, 3, 4 },
{ 5, 6, 7, 8 },
{ 9, 9.5f, 10, 11 },
{ 12, 13, 14.3f, 15 }
};
double[] testArray = { 1, 2, 3, 4 };
string testString = "Hellow world";
testMulti.AsSpan(); // Compile error
testArray.AsSpan();
testString.AsSpan();
虽然testArray和testString都有AsSpan扩展,但testMulti没有这样的扩展。
Span的设计是否仅限于处理单维数组数据?
我还没有找到使用Span处理testMulti数组的明显方法。
* sizeof(double)
。 - N8allan