What is the difference between Array.GetLength() and Array.Length?

前端 未结 5 1738
自闭症患者
自闭症患者 2020-12-13 08:51

How do you use the Array.GetLength function in C#?

What is the difference between the Length property and the GetLength functi

5条回答
  •  爱一瞬间的悲伤
    2020-12-13 09:48

    For 1-dimensional arrays Length and GetLength(0) are exactly the same.

    For arrays of higher rank Length is the product of all GetLength(0..Rank-1) values, in other words it is always the total number of fields.

提交回复
热议问题