System.StringBuilder and System.String classes

State the difference between System.StringBuilder and System.String classes?

E

Expert

Verified

StringBuilder and String classes are used for storing string values but the difference in them is that String is immutable (read only) by nature, because any value once assigned to String object cannot be changed after its creation. When value in String object is changed, a new object is created, in the memory, with new value assigned to the String object. Whereas, the StringBuilder class is mutable, since it occupies same space even after the value is changed. StringBuilder class is more efficient where you need to execute huge amount of string manipulation.

   Related Questions in DOT NET Programming

©TutorsGlobe All rights reserved 2022-2023.