What
is difference between String and StringBuilder?
String:-
In simple word we can say that String is Immutable.
We cannot insert, replace and append in String. When we replace value in String a new
instance is created and new value is assigned to this new instance and old
instance is deleted.
The
Namespace for String
is System.
Performance
of String
is low instead of StringBuilder.
StringBuilder:-
It is mutable and we can insert, replace
and append in StringBuilder.
When we replace in StringBuilder append method is used. No new instance is created
and no new value is assigned to StringBuilder.
The
Namespace for StringBuilder is System.text
Performance
of StringBuilder
is High instead of String
0 comments:
Post a Comment