Quantcast
Channel: What is the maximum possible length of a .NET string? - Stack Overflow
Browsing latest articles
Browse All 9 View Live

Answer by krishna Reddy for What is the maximum possible length of a .NET...

String allocates dynamic memory size in the heap of your RAM. But string address is stored in stack that occupies 4 bytes of memory.

View Article



Answer by WonderWorker for What is the maximum possible length of a .NET string?

The max length of a string on my machine is 1,073,741,791. You see, Strings aren't limited by integer as is commonly believed.Memory restrictions aside, Strings cannot have more than 230...

View Article

Answer by user922020 for What is the maximum possible length of a .NET string?

For anyone coming to this topic late, I could see that hitscan's "you probably shouldn't do that" might cause someone to ask what they should do…The StringBuilder class is often an easy...

View Article

Answer by loudej for What is the maximum possible length of a .NET string?

200 megs... at which point your app grinds to a virtual halt, has about a gig working set memory, and the o/s starts to act like you'll need to reboot.static void Main(string[] args){ string s = "hello...

View Article

Answer by HitScan for What is the maximum possible length of a .NET string?

The theoretical limit may be 2,147,483,647, 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 UTF-16 (2 bytes for each...

View Article


Answer by bdukes for What is the maximum possible length of a .NET string?

Based on my highly scientific and accurate experiment, it tops out on my machine well before 1,000,000,000 characters. (I'm still running the code below to get a better pinpoint).UPDATE:After a few...

View Article

Answer by VVS for What is the maximum possible length of a .NET string?

Since String.Length is an integer (that is an alias for Int32), its size is limited to Int32.MaxValue unicode characters. ;-)

View Article

Answer by Ryan Farley for What is the maximum possible length of a .NET string?

Since the Length property of System.String is an Int32, I would guess that that the maximum length would be 2,147,483,647 chars (max Int32 size). If it allowed longer you couldn't check the Length...

View Article


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

What is the longest string that can be created in .NET? The docs for the String class are silent on this question as far as I can see, so an authoritative answer might require some knowledge of...

View Article

Browsing latest articles
Browse All 9 View Live


Latest Images