Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C# (http://www.go4expert.com/forums/c-sharp/)
-   -   String Builder (http://www.go4expert.com/forums/string-builder-t27151/)

rajrprk@gmail.com 14Nov2011 16:57

String Builder
 
use of string builder in asp.net
please post examples for string builder

TradeM 27Nov2011 15:42

Re: String Builder
 
StringBuilder sb = new StringBuilder("1 = ");
sb.Append("One");
sb.Append(Environment.NewLine);
sb.AppendLine("2 = Two");
sb.AppendLine("3 = Three");
Displays:

1 = One
2 = Two
3 = Three

TradeM 28Nov2011 21:30

Re: String Builder
 
StringBuilder can be used instead of String and it provides most of the methods of String class. Since strings are immutable (they cannot be changed) so even when you change a single character in string the whole string gets recreated. Therefore if you need to do many string manipulations you should use StringBuilder class instead for performance reasons.

U Zafar
Software Engineer


All times are GMT +5.5. The time now is 07:49.