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 IS THE DIFFERENCE BETWEEN STRING AND STRING BUILDER ?

Answers were Sorted based on User's Feedback



WHAT IS THE DIFFERENCE BETWEEN STRING AND STRING BUILDER ?..

Answer / raviraj

String and String Builder class shows resemblance in terms
of values they accept(that contain series of haracters).But
the thing that distinguishes them is that string is
immutable .Immutable in the sense it will create a new copy
of memory whenever a new string is concatenated to the
existing string variable That means the existing memory is
deleted and replaced by the new memory.Whereas
Stringbuilder is mutable whenever we append a new string to
the existing string variable using append method the memory
containing the original string is extended to contain the
new string as well i.e, it won`t replace it with new memory
allocation.Hence performing string concatenations within
the same variable in the string class variables will affect
their performance.

Is This Answer Correct ?    17 Yes 0 No

WHAT IS THE DIFFERENCE BETWEEN STRING AND STRING BUILDER ?..

Answer / stanly jose

String and StringBuilder class stores strings. But you
cannot change a String object after creating one.
eg: String name = "Stanly";
you wan to change the same string name to
eg: name = "Stanly Jose";
then a new String object is creating in memory and assign
the new value as "Stanly Jose".
(A new name object is creating in memory and the
value "Stanly Jose" 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.

note:
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 ?    14 Yes 3 No

WHAT IS THE DIFFERENCE BETWEEN STRING AND STRING BUILDER ?..

Answer / sharifuddin

StringBuilder is a mutable, means no need to create new
variable,
But in string it is immutable, means reverse of string
builder each and every time new object for every new object
exist.

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More C Sharp Interview Questions

Is inheritance possible in c sharp?

0 Answers  


Can I call a virtual method from a constructor/destructor?

0 Answers  


What does void mean unity?

0 Answers  


What is the advantage of static class in c#?

0 Answers  


From which base class do all Web Forms inherit from?

0 Answers   Siebel,


What is CLR and its application.?

0 Answers   MCN Solutions,


What is ControlBox Propertie

0 Answers   MCN Solutions,


Give examples for reference types?

0 Answers  


Why generics are used?

0 Answers  


What is ioc containers c#?

0 Answers  


if you do have a stack overflow profile.what is your ranking?

0 Answers  


What is the main purpose of delegates in c#?

0 Answers  


Categories