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...


Difference between string and stringbuilder?

Answers were Sorted based on User's Feedback



Difference between string and stringbuilder?..

Answer / dsr

string is immutable.String and StringBuffer both are
classes.stringbuffer is mutable.

Is This Answer Correct ?    12 Yes 2 No

Difference between string and stringbuilder?..

Answer / akash

using String
if u want to append the text then u prefer's this thing
string strTemp="a";
strTemp=strTemp+"jay";

But in case of StringBuilder
if u want to do the samething then u will get a append() function.

Is This Answer Correct ?    6 Yes 3 No

Difference between string and stringbuilder?..

Answer / vinodh kumar

Though string looks like mutable(the value can be changed once after initial value) but string is not mutable. Every time you modify the string a new object reference will be created and it will gets updated. StringBuilder is mutable.

In situations like you want to concat strings in loopings, we'll use StringBuilder.

In loops like for, for each, while, etc., using string for concatenation it will give negative performance.

Conclusion:
-----------
String is Immutable.
StringBuilder is Mutable. For performance reasons during concatenation operations in string in conditional looping statements we use StringBuilder.
http://msdn.microsoft.com/en-us/library/system.text.stringbuilder.aspx

Is This Answer Correct ?    4 Yes 1 No

Post New Answer

More C Sharp Interview Questions

What is the use of system.environment class in c#.net?

0 Answers  


What is difference between Enum and Struct?

0 Answers   UGC Corporation,


What is Named parameter in C#?

0 Answers  


Differentiate between static class and singleton instance?

0 Answers  


What is view model in c#?

0 Answers  


What are the steps to make an assembly to public?

0 Answers  


what is meant inheritance. can you exaplain what kind inhertance ussed in your project

1 Answers  


There were a lot of questions asked, so I will list the topic (and add a what is "topic" and know pros/cons). Extreme programming, what is a transaction, various SDLC design approaches, what is a namespace, define a good test case, what is a stored proc, webservice? design patterns? linker? compiler? access modifiers? stack vs. queue? arrays vs. linked lists? sorting algorithms? recursion? OOP principles?

0 Answers   Avanade,


What does addressof operator do in background ?

0 Answers  


Is static thread safe?

0 Answers  


List the two important objects of ado.net and also list the namespaces that are commonly used in ado.net to aid in connection to a database.

0 Answers  


What is namespace give the example?

0 Answers  


Categories