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 / sandeep soni

String are Immutable (Not Modifiable). If you try to modify
the string it actually creates a new string and the old
string will be then ready for garbage collection.

StringBuilder when instantiated, creates a new string with
predefined capacity and upto that capacity it can
accodomate string without needing to create a new memory
location for the string....i mean it is modifiable and can
also grow as and when needed.

When the string needs to be modified frequently, preferably
use StringBuilder as its optimized for such situations.

Is This Answer Correct ?    113 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is main function of alternate teamplate of datalist?

2440


What is dependency injection in simple words?

968


Can we set image Source dynamically using C# in WPF application?

1125


what are the differences between a class and structure

1191


What does it mean to override a method?

1065


what is difference between is and as operators in c#?

1032


Write a C# program to find the Factorial of n

1028


Can c# inherit multiple classes?

993


What is transparent caching with aop ?

1172


Describe the difference between inline and code behind - which is best?

1195


How do I automate my desktop application?

1051


Explain how is the dll hell problem solved in .net?

906


Why do we need collections in c#?

916


What is native image generator (ngen.exe)?

1262


Can an abstract class have a constructor c#?

962