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
What is a generic method?
How many types of inheritance are there in c#?
What operators can be used to cast from one reference type to another without the risk of throwing an exception?
Why dataset is used in c#?
Ho we can see assembly information?
What is the difference between abstract class and interface in c#?
What is difference between C# and VB.NET?
Explain how do I convert a string to an int in c#?
Explain the use of Mutex in C#?
Are cao stateful in nature?
What is the difference between Static, Const and read only?
How do you escape in c#?
For methods inside the interface why can’t you specify the accessibility modifier?
What is cookies c#?
What is selector c#?