Hello Friends,
Is there any limit on number of values stored in an array?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Shweta LodhaPosted Nov 30, 2014, 1:35 AM
The max no of elements that can be stored in an array is int32.MaxValue (2 147 483 647) in theory but by default the maximum size of an array is 2 gigabytes as mentioned on MSDN here: http://msdn.microsoft.com/en-us/library/System.Array%28v=vs.110%29.aspx.
In a 64-bit environment, you can avoid the size restriction by setting the enabled attribute of the gcAllowVeryLargeObjects configuration element to true in the run-time environment. However, the array will still be limited to a total of 4 billion elements, and to a maximum index of 0X7FEFFFFF in any given dimension (0X7FFFFFC7 for byte arrays and arrays of single-byte structures).