c# string size limit? length of string limit?

c# string size limit? length of string limit?

Post by Danie » Thu, 20 Apr 2006 09:38:48


c# string size limit? length of string limit?
 
 
 

c# string size limit? length of string limit?

Post by Patric » Thu, 20 Apr 2006 18:15:37

Just give it a try. Likely Integer.MaxValue at best. That is not a practical
limit but rather therorical limit (IMO yuou 'll have an out of memory error
before)


--


XXXX@XXXXX.COM ...

 
 
 

c# string size limit? length of string limit?

Post by Daniel O'C » Thu, 20 Apr 2006 18:44:21


Well, its not quite that simple. int.MaxValue is the most the string class
itself could handle, you are right, but since characters take up two bytes,
that many characters would go way beyond the max possible allocation. The
best theoretical high value is 2^31(or 2147483648) characters, since that is
exactly how many would fit in memory. Practially it'd be much, much smaller.

The bigger question is what is wrong with your design if you are dealing
with strings that are gigabytes in length.