Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the maximum size for a string in C#? [duplicate]

Tags:

string

c#

Possible Duplicate:
What is the maximum possible length of a .NET string?

I need to know how many characters a string can contain in C#?

Is it the same as the max length of a char array?

like image 338
Todd Moses Avatar asked Dec 03 '10 18:12

Todd Moses


1 Answers

String.Length is an int so the its size is 2,147,483,647. But consider using StringBuilder if you find yourself asking this question !

like image 171
Vishal Avatar answered Nov 14 '22 17:11

Vishal