What?s the difference between System.String and
System.StringBuilder classes?
Answer Posted / sundarchum
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 ? | 3 Yes | 0 No |
Post New Answer View All Answers
How can we sort the elements of the array in descending order?
Wht executescaler method is used?
What is the difference between interface and functional interface?
Distinguish between continue and break statement?
When should you use generics?
Explain the process of Serialization?
Does a loop recorder have to be removed?
What is delegate in c#?
What is a function c#?
Who is a accessibility modifier “protected internal†available to ?
What is the default value of guid in c#?
Define a class and an object?
What are the problem with .NET generics?
Can we set image Source dynamically using C# in WPF application?
Can firstordefault return null?