What is the Main difference between String and
StringBuilder and why do we use StringBuilder.
Answer Posted / shaveen kaushal
Difference..
String..
1.Its a class used to handle strings.
2.Here concatenation is used to combine two strings.
3.String object is used to concatenate two strings.
4.The first string is combined to the other string by
creating a new copy in the memory as a string object, and
then the old
string is deleted
5.we say "Strings are immutable".
String Builder..
1.This is also the class used to handle strings.
2.Here Append method is used.
3.Here, Stringbuilder object is used.
4.Insertion is done on the existing string.
5.Usage of StringBuilder is more efficient in case large
amounts of string manipulations have to be performed
Regards
Sridhar R
Nothing is illegal, Until You Get Caught
| Is This Answer Correct ? | 39 Yes | 7 No |
Post New Answer View All Answers
what is the difference between .dll and .exe
What are scriptable objects?
What is a byte in c#?
What does return do in unity?
What is string [] args in c#?
what is virtual method in c#?
What is lazy in c#?
What is list array in c#?
What is a scope in c#?
What are the types of class in c#?
What is clr in c#?
In C#, explain the difference between overloading and overriding.
What is the use of readkey in c#?
From a versioning perspective, what are the drawbacks of extending an interface as opposed to extending a class?
What are c# i/o classes? What are the commonly used i/o classes?