What?s the difference between System.String and
System.StringBuilder classes?
Answer Posted / sundarchum
Both the String and StringBuilder class are used to store
strings. One exception is when we change the value in the
string it will create a new String object is creating in
memory and assign the new value.
eg: String name = "Sundar";
A new name object is creating in memory and the
value "Sundar Rahul" is assinging to the newly created
space.
eg: String name = "Sundar Rahul";
But StringBuilder class occupies the same space even if you
change the value.
StringBuilder gives you better performance than String
class when you perform string manipulations like string
concatenation.
You can use StringBuilder's Append() method to use
concatenation and for String use "+".
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Can you prevent a class from being instantiated?
How can we make a thread sleep for infinite period ?
Which class comes after the SortedList class?
Define c# and list the features.
Where do we set the min and max pool size for connection pooling?
What is the difference between namespace and class in c#?
Can we have multiple constructors in a class c#?
Can abstract class have constructor c#?
How does substring work in c#?
Enlist some of the properties of a thread class?
Why delegates are type safe in c#?
What is Satellite Assemblies ?
Is c# slower than java?
What is an object pool in .net?
What is the use of thread join in c#?