What?s the difference between System.String and
System.StringBuilder classes?
Answer Posted / sandeep joshi
String and StringBuilder class stores strings. But when you
cannot change a String object after creating one.
eg: String name = "Joshi";
By saying you cannot change the name object means you
cannot change the value in name object internally. When you
change the name object value to something else, a new
String object is creating in memory and assign the new
value.
eg: name = "Sandeep Joshi";
A new name object is creating in memory and the
value "Rengan nathan" is assinging to the newly created
space.
But StringBuilder class occupies the same space even if you
change the value.
If you are doing string concatenation StringBuilder class
is far better in performance than String class.
You can use StringBuilder's Append() method to use
concatenation.
i hope this may help u
| Is This Answer Correct ? | 20 Yes | 1 No |
Post New Answer View All Answers
What is serialization in dot net?
Explain the difference between proc. Sent by val and by sub?
What is the use of properties window?
What is the difference between method and constructor in c#?
Is stringbuilder faster than string concatenation c#?
Suppose two interfaces have same method, so how will you implement these methods in derive class?
What is writeline in c#?
How do I create a delegate/multicastdelegate?
What is the difference between finalize() and dispose() methods?
What is a static field?
If the original method is not static you can declare an override method to be static or not?
Which are the access modifiers available in c#?
What is the purpose of a constructor in c#?
Can the accessibility of a type member be greater than the accessibility of its containing type?
What are custom exceptions in C#?