What?s the difference between System.String and
System.StringBuilder classes?

Answer Posted / akash

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 ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What happens during the process of boxing?

821


What's the difference between abstraction and encapsulation?

678


What are the differences between events and delegates in c#?

682


What is c# console application?

696


What does the keyword “virtual” declare for a method or property?

737


what is a constructor? What is a destructor?

735


What is the use of command builder?

737


If casting fails what type of exception is thrown?

657


What is global asax in c#?

722


what is object-oriented programming (oop) language?

667


What is expandoobject in c#?

670


To catch any possible exception What is the C# syntax written ?

751


What is c# entity framework?

661


What is the difference between do and while loop?

665


What is delegates in c# and uses of delegates?

650