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
Why do we override in c#?
What are bitwise logical operators?
Is struct object oriented?
What language is arduino?
Why data types are important in c#?
How can you set image source dynamically from c# application to ”test.png” file?
What is class method c#?
What is the lock statement in c#?
Write a program to find the angle between the hours and minutes in a clock
Which is faster array or arraylist in c#?
What is the difference between list and arraylist c#?
Which is faster dictionary or hashtable?
Where do we use serialization in c#?
Is stringbuilder better than string?
Explain lock, monitors, and mutex object in threading.