开发者

C# array byte[].Length property

C# array byte[].Length property.

byte[] buffer = new ...

When call开发者_运维技巧 int i = buffer.Length; I can see get_Length() in reflector,

What happens? Does it calculate actual length or just takes value (like property) ???


byte[].Length will tell you the total number of elements in the array, so retrieving this property has a complexity of O(1).


Arrays are fixed-length; the Length property returns an internal field in the array.
(It's O(1), not O(n))

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜