Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is the Main difference between String and
StringBuilder and why do we use StringBuilder.

Answer Posted / vijay rana

String class is immutable, means we can not change the
contents of string at run time,
for example
String s1="loin";
string s2=s1.insert(3,"g");
now s2 have the value login ,but one thing to notice here is
that we are not assigning this value into s1, because it is
not possible in String class
,but if we want to change the contents of s1 then we will
have to take the StringBuilder calss
because with the help of this class we can change the
contents of same string
examlpe:
String s1="loin";
s1=s1.insert(3,"g");
now s1 is "login"
here we are assigning the value again in s1,
this is the main difference between in string and
stringBuilder class

Is This Answer Correct ?    43 Yes 27 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is array collection?

1023


Can we override interface method?

1030


What are the classes contained in a single .NET DLL ?

975


Where is the main method in c#?

1044


How long will it take to learn c sharp?

989


What is out int in c#?

961


What are the different approaches of passing parameters to a method?

1018


List down the differences between “dispose” and “finalize” methods in c#.

888


Can we change static value in c#?

1124


What the different phase/steps of acquiring a proxy object in webservice?

1079


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

995


What is the purpose of namespace in c#?

919


What is the lock statement in c#?

1040


Can we inherit static class in c#?

1037


What is ioc containers c#?

930