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
How can I use .NET components from COM programs?
Can we overload the main method in c#?
What is the use of functional interface?
What is a delegate? How can it works?
Define parsing? Explain how to parse a datetime string?
Explain different properties of object oriented systems.
Explain About multi level and multiple inheritance how to achieve in .net
How jit (just in time) works?
What are get and set in c#?
What is a cs file?
How many bits is int32?
What is a multi line comment?
What is typeof c#?
What is lazy loading c#?
How is a string immutable?