I have a web service that returns HTML for a table (for optimization purposes) in a string. One thing I am cautious about is the limit of data I am allowed to put in a string variable in C#, as well as any other possible limitations or warnings?
I read on online forums that string is quite accommodating and you can shove up to 1GB of data in it (which would certainly suffice for my purposes). Any input?
A string — or any other object — can be up to 2GB in size in the Microsoft CLR. (This is only an implementation detail, not a specified standard. Other implementations might have different restrictions.)
Since strings are UTF-16 each character requires two bytes, which means that a string can contain a maximum of 1 Giga-characters.