Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What?s the difference between System.String and
System.StringBuilder classes?

Answers were Sorted based on User's Feedback



What?s the difference between System.String and System.StringBuilder classes?..

Answer / sandeep joshi

String and StringBuilder class stores strings. But when you
cannot change a String object after creating one.
eg: String name = "Joshi";
By saying you cannot change the name object means you
cannot change the value in name object internally. When you
change the name object value to something else, a new
String object is creating in memory and assign the new
value.

eg: name = "Sandeep Joshi";

A new name object is creating in memory and the
value "Rengan nathan" is assinging to the newly created
space.

But StringBuilder class occupies the same space even if you
change the value.

If you are doing string concatenation StringBuilder class
is far better in performance than String class.

You can use StringBuilder's Append() method to use
concatenation.
i hope this may help u

Is This Answer Correct ?    20 Yes 1 No

What?s the difference between System.String and System.StringBuilder classes?..

Answer / guest

System.String is immutable; System.StringBuilder was
designed with the purpose of having a mutable string where
a variety of operations can be performed.

Is This Answer Correct ?    19 Yes 3 No

What?s the difference between System.String and System.StringBuilder classes?..

Answer / naveen

prefer System.StringBuilder when you are doing lot of
string manuplation operations. In which case the same
string in the memory is manipulated for the resultant
operation where as when System.String variable is used
every time a new string instance is created in the memory

Is This Answer Correct ?    15 Yes 3 No

What?s the difference between System.String and System.StringBuilder classes?..

Answer / sandeep joshi

String and StringBuilder class stores strings. But when you
cannot change a String object after creating one.
eg: String name = "Joshi";
By saying you cannot change the name object means you
cannot change the value in name object internally. When you
change the name object value to something else, a new
String object is creating in memory and assign the new
value.

eg: name = "Sandeep Joshi";

A new name object is creating in memory and the
value "Sandeep Joshi" is assinging to the newly created
space.

But StringBuilder class occupies the same space even if you
change the value.
If you are doing string concatenation StringBuilder class
is far better in performance than String class.
You can use StringBuilder's Append() method to use
concatenation and also use Reverse,Remove methods.
Usually, String is immutable which means once you have the
content there you cannot change it. While StringBuilder is
mutable because it allows you to change the content you
have already placed.

Notice that a string allows you to change the content but
offcourse it creates a new string reference. For example,
all string methods return a new string and don't update the
same string variable.

Is This Answer Correct ?    10 Yes 2 No

What?s the difference between System.String and System.StringBuilder classes?..

Answer / chirag

differnt between system.string and system.stringbuilt

Is This Answer Correct ?    1 Yes 4 No

Post New Answer

More C Sharp Interview Questions

For methods inside the interface why can’t you specify the accessibility modifier?

0 Answers   Siebel,


What?s the difference between System.String and System.StringBuilder classes?

5 Answers  


Can constructor be protected?

0 Answers  


if i want to transmit binary data,,,will it be support by Webservices or any exceptions ? define

2 Answers  


Explain the three services model (three-tier application).

3 Answers   4Cplus,


Does C# support multiple inheritance?

3 Answers   IBM, Siebel Systems, Visual Soft,


Explain the three services model (three-tier application). Presentation (ui), business (logic and underlying code) and data (from storage or other sources).

0 Answers  


What is assembly version series sequence?

0 Answers  


Differentiate between copy and default constructor.

0 Answers   TCS,


What is the main method in c#?

0 Answers  


What is unmannaged code and will CLR handle this kind of code or not .

0 Answers   DELL,


Can you store strings in arrays?

0 Answers  


Categories