C# Programming - Strings - Discussion
Discussion Forum : Strings - General Questions (Q.No. 4)
4.
The string built using the String class are immutable (unchangeable), whereas, the ones built- using the StringBuilder class are mutable.
Discussion:
3 comments Page 1 of 1.
Vamsee said:
1 decade ago
Strings are immutable means that when ever you perform operation on them they create a new object every time, where as string builder class will not create multiple objects and performs operations on the same object. This saves lot of memory in terms of creating objects.
Nishant said:
1 decade ago
Using System.String class you can create immutable string means that their contents once created cannot be changed.
Using Stringbuilder class you can create the mutable strings.
Using Stringbuilder class you can create the mutable strings.
Vixen said:
1 decade ago
First in StringBuilder you can only append string, which is only on of many ways how to change it. Second, String builder is much more an array than string itself, ToString method returns any time different instance to string.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers