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?
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?
I am not sure whether I properly understood your requirement, but here are my comments.
Why do you need to set the maxsize for the new array ? instead you could simply make use of list which will dynamically get increase as required.
for ex : List<string> str = new List<string>();
Also, if you set some maxsize to array then probably your program could waste precious memory.
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).