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

后端 未结 8 1670
梦毁少年i
梦毁少年i 2020-11-22 02:48

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 answe

相关标签:
8条回答
  • 2020-11-22 03:29

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

    0 讨论(0)
  • 2020-11-22 03:38

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

    0 讨论(0)
提交回复
热议问题