What is the Main difference between String and
StringBuilder and why do we use StringBuilder.
Answer Posted / shaveen kaushal
Difference..
String..
1.Its a class used to handle strings.
2.Here concatenation is used to combine two strings.
3.String object is used to concatenate two strings.
4.The first string is combined to the other string by
creating a new copy in the memory as a string object, and
then the old
string is deleted
5.we say "Strings are immutable".
String Builder..
1.This is also the class used to handle strings.
2.Here Append method is used.
3.Here, Stringbuilder object is used.
4.Insertion is done on the existing string.
5.Usage of StringBuilder is more efficient in case large
amounts of string manipulations have to be performed
Regards
Sridhar R
Nothing is illegal, Until You Get Caught
| Is This Answer Correct ? | 39 Yes | 7 No |
Post New Answer View All Answers
Explain the difference between Response.Write () and Response.Output.Write ().
What is managed or unmanaged code?
Enlist some of the properties of a thread class?
What is access specifier in c#?
Which technology is best for desktop application?
What is collection of classes in c#?
How to declares a two-dimensional array in C#?
What does return do in unity?
What is type safe in c#?
Is static class thread safe in c#?
Are c# tuples immutable?
What is an escape sequence? Name some string escape sequences in c#.
What is a function c#?
Is it possible to execute multiple catch block for a single try statement?
Which .gang of four. Design pattern is shown below?