DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   C# (http://www.daniweb.com/forums/forum61.html)
-   -   using in lass StringBuilder (http://www.daniweb.com/forums/thread160677.html)

polo_coins Dec 4th, 2008 4:43 am
using in lass StringBuilder
 
I discovered that there is a such class like StringBuilder
but I don't find any thing that convince me to use it.
Explain me it's advantage and disadvantage and if you gave some examples I like to see them

thanks a lot Sergey

LizR Dec 4th, 2008 5:58 am
Re: using in lass StringBuilder
 
String builder can have advantages when buidling up output. So instead of a ton of

s += titletext;
s += "\r\n--------";

etc

you can just do
sb.append(newtext);
sb.appendline("---------");

it acts almost like a buffer, however if you've done much coding before it does feel unnecessary and isnt the way your brain is used thinking.

polo_coins Dec 4th, 2008 6:51 am
Re: using in lass StringBuilder
 
[QUOTE=LizR;750021]String builder can have advantages when buidling up output. So instead of a ton of

s += titletext;
s += "\r\n--------";

etc

you can just do
sb.append(newtext);
sb.appendline("---------");

it acts almost like a buffer, however if you've done much coding before it does feel unnecessary and isnt the way your brain is used thinking.[/QUO
thanks LIZR


All times are GMT -4. The time now is 7:09 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC