简体   繁体   English

数组类型声明C#

[英]Array Type Declaration C#

I'm declaring an array of 16bit signed integers whose elements may run into the millions. 我声明了一个16位带符号整数数组,其元素可能会达到数百万个。 I've been declaring the array as type Long as I was thinking along the terms of element length instead of the limit of each individual element. 我一直在按照元素长度而不是每个元素的限制来考虑,将数组声明为Long类型。 Is it correct to declare the type of array according to element types? 根据元素类型声明数组的类型是否正确?

Thanks 谢谢

The element type of an array has nothing to do with the type of the index. 数组的元素类型与索引的类型无关。
C# arrays only support 32-bit int indexing. C#数组仅支持32位int索引。

You should use a short[] . 您应该使用short[]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM