Difference between string and stringbuilder?
Answers were Sorted based on User's Feedback
Answer / dsr
string is immutable.String and StringBuffer both are
classes.stringbuffer is mutable.
| Is This Answer Correct ? | 12 Yes | 2 No |
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 |
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 |
What is the use of system.environment class in c#.net?
What is difference between Enum and Struct?
What is Named parameter in C#?
Differentiate between static class and singleton instance?
What is view model in c#?
What are the steps to make an assembly to public?
what is meant inheritance. can you exaplain what kind inhertance ussed in your project
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?
What does addressof operator do in background ?
Is static thread safe?
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.
What is namespace give the example?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)