Diff b/w String and String Builder in C#.Net

Strings:
  • Strings are internally represented as character array
  • System namespace contains a class string 
  • System.String class is used to work with string litter ls   
  • String litterls are nothing but a Sequence of Characters these are enclosed with double quotes 
  • when we want to use string methods every time we have to create string object in the memory
  • so it will degrade the performance of application 
  • strings are immutable means,value cant be changed
Ex:
String s="Santhosh"

String Builder:

  • String Builder is mutable means,value can be changed
  • when we want to modify a string using string builder no need to create object 
  • it will improves the performance of application 

No comments:

Post a Comment