What is the Main difference between String and
StringBuilder and why do we use StringBuilder.

Answer Posted / ankur prasad gupta

Difference..
String..
1.Its a class used to handle strings.
2.Here concatenation is used to combine two strings.
3.String object is used to concatenate two strings.
4.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
5.we say "Strings are immutable".

String Builder..
1.This is also the class used to handle strings.
2.Here Append method is used.
3.Here, Stringbuilder object is used.
4.Insertion is done on the existing string.
5.Usage of StringBuilder is more efficient in case large amounts of string manipulations have to be performed

Is This Answer Correct ?    19 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the process of polymorphism with an example?

476


What is console read in c#?

489


Can I use exceptions in c#?

545


What is a jagged array?

495


Can interface inherit class in c#?

491






What are the desktop applications?

469


What is expression tree in c#?

483


What is the difference between field and property in c#?

472


Helo , Help Me , Help Me About : C# Windows Application - Network How To Manage IP Client's Accessiblity To The Internet Share concise Substitute , Minor ISA Server

1460


hi my question is about understanding a text the user entered to a site , so i want to analyse that text looking for some specific items such as "honda" "shoffere" etc.. so if this site could help or could tell me where to go with such question ,i wonder. thanks

1590


Does main have to be static c#?

489


What is concrete class in c# with example?

469


What is the main purpose of linq?

481


What is iqueryable in linq?

497


What is the different types of private assembly and shared assembly?

503