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


Please Help Members By Posting Answers For Below Questions

How many classes are there in classification?

509


Explain About Global.asax

573


What is parameterized constructor?

511


Name the property of the textbox which cannot be changed at runtime?

525


What are the boolean data types in c#?

512






Explain the features of an abstract class in net.

505


Is char * null terminated?

528


Why do we use polymorphism in c#?

478


What is nameof c#?

489


What are types of constructor?

478


What is the difference between dispose() and finalize() methods in c#?

511


Define delay signing?

534


What does exclamation mark mean in access query?

551


What is the use of private constructor in c#?

498


What is meant by unicode characters?

569