3
Reply

What are the differences between String and String Builder?

Ajeet Mishra

Ajeet Mishra

Sep 07, 2015
419
0

    http://www.aspdotnet-suresh.com/2013/11/difference-between-string-and-stringbuilder-csharp.html

    Munesh Sharma
    May 31, 2016
    0

    String -----------String is immutable. Immutable means once we create string object we cannot modify. Any operation like insert, replace or append happened to change string simply it will discard the old value and it will create new instance in memory to hold the new value. Performance wise string is slow because every time it will create new instance In string we don’t have append keywordString Builder ----------------------String builder is mutable it means once we create string builder object we can perform any operation like insert, replace or append without creating new instance for every time. Performance wise stringbuilder is high because it will use same instance of object to perform any action In StringBuilder we can use append keyword

    Avikshith Aradhya
    May 30, 2016
    0

    String String objects are immutable, which means that once they are created they cannot be changed. When we use one of the methods of the String class, we create a new string object. Here concatenation is used to combine two strings. String object is used to concatenate two strings. 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 Less efficient String Builder StringBuilder are mutable class, which means when concatenate any text to the variable it allows us to modify the original value without creating a new object. Here Append method is used. Stringbuilder object is used. Insertion is done on the existing string. StringBuilder is more efficient for large amounts of string manipulations

    Ajeet Mishra
    September 07, 2015
    0