9
Reply

What are differences between system.stringbuilder and system.string?

Meenakshi Pillay

Meenakshi Pillay

Mar 27, 2014
9.8k
0

    1) String are fixed length where stringbuilder is just like variable length. At the time of declaration the given length is called limitation which is String. At the run-time increasing the size is called capacity which is StringBuilder.

    Sandeep Singh
    September 16, 2016
    2

    The main difference is system.string is immutable and system.stringbuilder is a mutable. Usage of String Builder is more efficient in case large amounts of string manipulations. Performance wise string is slow because every time it will create new instance.

    Gaurav Jain
    June 25, 2015
    2

    The main difference is system.string is immutable and system.stringbuilder is a mutable. Append keyword is used in string builder but not in system.string.
    Immutable means once we created we cannot modified. Suppose if we want give new value to old value simply it will discarded the old value and it will create new instance in memory to hold the new value.

    Meenakshi Pillay
    March 27, 2014
    2

    system.string is immutable and we can,t change the size of string object while system.stringbuilder is mutable and we can change the size of stringbuilder class object.

    vartika tomar
    July 13, 2015
    0

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

    Munesh Sharma
    October 09, 2014
    0

    System.string is immutable .ie it means when we do any operations on string object new object is created. system. String builder is mutable ,ie we can do various operations on the string, no new string object is created.

    Roymon TP
    October 09, 2014
    0

    The best example for understand to stringbulider and string :for String : string s = string.Empty; for (i = 0; i < 10; i ) {s = i.ToString() " "; }for stringbuilder : StringBuilder sb = new StringBuilder(); for (i = 0; i < 10; i ) {sb.Append(i);sb.Append(' '); }

    Dileep Kumar Patel
    April 03, 2014
    0

    Both String and String Builder are classes used to handle strings.string is concatenation can performed very efficiently.when concatenation is done it creats a new copy in the memory as a string object, and then the old string is deleted. This process is a little long. Hence we say "Strings are immutable". When we make use of the "String Builder" object, the Append method is used. This means, an insertion is done on the existing string. Operation on String Builder object is faster than String operations, as it is done at same location. Usage of String Builder is more efficient in case large amounts of string manipulations.

    raja ram
    April 03, 2014
    0

    System.String is immutable.Immutable means once we create string object we cannot modify Where as System.StringBuilder is mutablePerformance wise string is slow because every time it will create new instance

    Abhay Shanker
    April 02, 2014
    0