hi,
system.stringbuilder is updateble and sustem.string is non updatable
system.string we cannot do many operations while system.stringbuilder is can do
Both String and String Builder are classes use to handle Strings.
The most common operation with a string is Concatenation. When we use string object to concatenate two strings, the first string is combined with the new string by creating a new object in the memory as string object, and the old string object is deleted. So String is also called immutable.
If we use String builder object and use Append method ,the concatenation is done in the existing string. String builder is also called mutable
So operation on string builder is faster than the string object.
String builder is more efficient in case large amount of string operations have to be perform.
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
Time is Gold
Thanks & Regards,
Rajesh Kumar,
9962038582.
Shanky11, if this helps please login to Mark As Answer. | Alert Moderator