Mickey
Mickey

Reputation: 313

Array Type Declaration C#

I'm declaring an array of 16bit signed integers whose elements may run into the millions. 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. Is it correct to declare the type of array according to element types?

Thanks

Upvotes: 1

Views: 158

Answers (1)

SLaks
SLaks

Reputation: 887415

The element type of an array has nothing to do with the type of the index.
C# arrays only support 32-bit int indexing.

You should use a short[].

Upvotes: 6

Related Questions