开发者

What is the difference between Rank and specifying [,] in an array?

开发者 https://www.devze.com 2023-01-19 07:46 出处:网络
In .NET, there is a Rank property for arrays. 开发者_如何学编程What is the difference between this and specifiying something like:

In .NET, there is a Rank property for arrays.

开发者_如何学编程What is the difference between this and specifiying something like:

int[,] intArray = new int[3,3]; ?

Which would be of Rank 2?

Thanks


The Rank property is read-only. It is part of the type of the array and can only be set when the array is created. The expression int[,] refers to the type of rank 2 integer arrays, and you can create a rank 2 array either with the new int[n,m] syntax or with the Array.CreateInstance static method.

0

精彩评论

暂无评论...
验证码 换一张
取 消