Hello Friends,
Is there any limit on number of values stored in an array?
Limt of array
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Shweta LodhaRank #31 · 39.8K reputationPosted Nov 29, 2014, 8:35 PM EST
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).