Possible Duplicate:
What is the Maximum Size that an Array can hold?
i want to define new array for example:
string[] str=new string[maxsize];
now the maximum number that i can set for maxsize is what?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
UPDATED: According to comments below, .NET limits arrays to 2GB of members (or bytes?). I’d guess this is due to it using a signed 32-bit integer for the index, but that’s just a wild guess.
Regardless, the maximum is nowhere near what you should ever need in day to day use. The larger question is why you would want to allocate an array with that many members. If you need a particularly huge array then you should allocate one on-demand the specific size you need (or use a dynamically resizing container).
… BUT if you have some special need, you could always link multiple arrays together. The last member of each array could point to the next array (or point to nothing to end the single linked list).