Click here to Skip to main content
14,691,771 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
what is the max. length of the string variable when using in c#

And also tell me the max. Query String Length when using ado.net in c#

Plz tell Exact Figure
Posted
Updated 12-Oct-20 22:19pm
v2
Comments
Keith Barrow 14-Aug-13 9:44am
   
My vote of 1: This is extremely Googlable information. Google "c# max string length" and there are 1.6 million results

1 solution

The theoretical limit may be 2,147,483,647 chars but the practical limit is nowhere near that. Since no single object in a .Net program may be over 2GB and the string type uses unicode (2 bytes for each character), the best you could do is 1,073,741,823, but you're not likely to ever be able to allocate that on a 32-bit machine.

And,maximum length of Query String depends on browser.Refer..
Maximum length of Query String?[^]
   
v3
Comments
binadi007 14-Aug-13 8:46am
   
Thankx :)
ridoy 14-Aug-13 9:21am
   
glad to help you.:)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900