What?s the difference between System.String and
System.StringBuilder classes?
Answer Posted / akash
Both the String and StringBuilder class are used to store
strings. One exception is when we change the value in the
string it will create a new String object is creating in
memory and assign the new value.
eg: String name = "Sundar";
A new name object is creating in memory and the
value "Sundar Rahul" is assinging to the newly created
space.
eg: String name = "Sundar Rahul";
But StringBuilder class occupies the same space even if you
change the value.
StringBuilder gives you better performance than String
class when you perform string manipulations like string
concatenation.
You can use StringBuilder's Append() method to use
concatenation and for String use "+".
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is delegates and events?
In C#, explain the difference between overloading and overriding.
Why static variables are used?
Does c# support a variable number of arguments?
Is c# pass by value?
What is difference between private and static constructor?
What is the difference between array and arraylist in c#?
Who introduced c#?
Distinguish between finally and finalize blocks?
Differentiate between sqlclient oledb and providers?
Why delegate is used in c#?
Any problem found in vs.et
What is the difference between system.string and system.text.stringbuilder classes?
Distinguish between the Debug class and Trace class with its functionality?
What is polymorphism and its types in c#?