What’s the difference between System.String and
System.Text.StringBuilder classes with example

Answer Posted / puneet mishra

according to me difference between a string class and using String Builder is that in using a string class you need to create new object befour appending it to the main string but in string builder class one don`t need to create object every time

Example for string builder class:
using System.Text;

stringBuilder str = new stringBuilder;
str.append("");

in the previous example once u create str as new instance of string builder class u just have to append every thing in to the string

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between field and variable in c#?

557


What is the difference between an implicit conversion and an explicit conversion?

577


What is cts, clr?

513


What is immutable in C#?

673


What is a class level variable in c#?

586






Is it possible to restrict the scope of a field/method of a class to the classes in the same namespace?

573


Is it possible to have different access modifiers on the get/set methods of a property in c#?

675


Why dictionary is used in c#?

614


Wht executescaler method is used?

615


What is the difference between icomparer and icomparable in c#?

543


What is boxing & unboxing?

659


What is for loop in c#?

586


Can firstordefault return null?

604


What are the collection types can be used in c#?

540


Why do we use constructors in c#?

669