difference b/w string and string builder [Resolved]

Posted by Sekar.C under C# on 3/15/2012 | Points: 10 | Views : 5082 | Status : [Member] | Replies : 10
hi,
difference b/w string and string builder in c# with example

regrads
sekar.c

Regards
Sekar.c



Responses

Posted by: Muhsinathk on: 9/11/2012 [Member] Bronze | Points: 50

Up
0
Down

Resolved
String

1.String object is immutable
2.Data value maynot be Changed and Variable value may be changed.

StringBuilder
1.StringBuilder objects are mutable
2.StringBuilder performs is faster than Strings

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hmanjarawala on: 3/15/2012 [Member] Bronze | Points: 25

Up
0
Down
Hi sekar,
have this:

http://www.codeproject.com/Articles/6771/String-Vs-StringBuilder-C
http://chaoticjava.com/posts/stringbuilder-vs-string/

Himanshu Manjarawala
Sr. Software Engineer@AutomationAnywhere
http://fieredotnet.wordpress.com/

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Patel28rajendra on: 3/15/2012 [Member] Starter | Points: 25

Up
0
Down
Hi

string is used to store simple string and on string Builder we can perform operation like append etc.


Thanks



R D Patel

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sksamantaray on: 3/15/2012 [Member] Silver | Points: 25

Up
0
Down
Hi,Sekar
Read this once:
http://www.allinterview.com/showanswers/63507.html

Thanks,
Sanjay

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Revathy on: 9/10/2012 [Member] Starter | Points: 25

Up
0
Down
is n't possible to append string..?

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gopesh9 on: 9/10/2012 [Member] Starter | Points: 25

Up
0
Down
Hey,

StringBuilder is a "Mutable" class that means you can insert,append,replace without creating a new StringBuilder each time. That means if you have created an instance of string builder class then whenever you append,delete or update, that object of StringBuilder class will point to the same location.
Strings are "Immutable" , each time you perform any operation then you are creating a new string. Thus we can say that whenever you do any operation in the string object it points to new location.

G. S.
.Net Developer

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Calvert on: 9/12/2012 [Member] Starter | Points: 25

Up
0
Down
Strings are immutable means Data value maynot be Changed and Variable value may be changed. StringBuilder performs is faster than Strings. and also designed for Mutable Strings
we can use like this System.text.StringBuilder For more click http://www.dapfor.com/en/net-suite/net-grid/tutorial/data-binding

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 9/12/2012 [Member] Starter | Points: 25

Up
0
Down
StringBuilder is a mutable class, meaning you can insert/append/replace/etc. without creating a new StringBuilder each time.
String is immutable, each time you perform an operation that "changes" it you are creating a new string to replace the old one.
As mentioned above multiple times, that makes the StringBuilder more efficient for operations that manipulate strings.

Thanks & Regards
Hari

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rambabu123 on: 9/12/2012 [Member] Starter | Points: 25

Up
0
Down
StringBuilder is a mutable class, meaning you can insert/append/replace/etc. without creating a new StringBuilder each time.
String is immutable, each time you perform an operation that "changes" it you are creating a new string to replace the old one

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Muhsinathk on: 9/14/2012 [Member] Bronze | Points: 25

Up
0
Down
Hi Sekar,
Please Mark as Answer if it helpful to you..That helps others who search the same...

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response