我有一个数组定义的:
int [,] ary;
// ...
int nArea = ary.Length; // x*y or total area
这是一切都很好,错误我需要知道这个数组是在 X
和是单独的尺寸。也就是说,它们
ary.Length
可能会返回12 - 但这是否意味着数组为4高3宽,或6个高2个宽
This is all well and good, bug I need to know how wide this array is in the x
and y
dimensions individually. Namely, they ary.Length
might return 12 - but does that mean the array is 4 high and 3 wide, or 6 high and 2 wide?
我怎样才能检索到的信息?
How can I retrieve this information?
您使用阵.GetLength 与要检索维度的指标。
You use Array.GetLength with the index of the dimension you wish to retrieve.
上一篇:C#.Net Core 3.1 System.Text.Json在序列化中忽略空集合序列化、Core、Net、Json
下一篇:<;FrameworkReference Include=";Microsoft.AspNetCore.App&/>;在.Net Core 3+中实际上