System.String is immutable. When we modify the value of a string variable then a new memory is allocated to the new value and the previous memory allocation released.
System.StringBuilder was designed to have concept of a mutable string where a variety of operations can be performed without allocation separate memory location for the modified string.
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
System.String is immutable. When we modify the value of a string variable then a new memory is allocated to the new value and the previous memory allocation released.
System.StringBuilder was designed to have concept of a mutable string where a variety of operations can be performed without allocation separate memory location for the modified string.