Ajeet Mishra
What are the differences between String and String Builder?
By Ajeet Mishra in .NET on Sep 07 2015
  • Munesh Sharma
    May, 2016 31

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

    • 0
  • Avikshith Aradhya
    May, 2016 30

    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

    • 0
  • Ajeet Mishra
    Sep, 2015 7

    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

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS