String in C#
What is the purpose of using System.Text.StringBuilder over System.String?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted Jun 26, 2012, 9:04 AM
StringBuilder is more efficient in cases where there is a large amount of string manipulation. Strings are immutable, so each time a string is changed, a new instance in memory is created.
System.StringBuilder is mutable where variety of operations can be performed
System.String is immutable variable value may change But original data value will be discarded and new value will be in memory.
hope this will help u.
Santhosh Kumar JayaramanPosted Jun 26, 2012, 7:54 AM
http://www.c-sharpcorner.com/UploadFile/8832bd/string-vs-stringbuilder-in-net/
Posted Jun 26, 2012, 7:52 AM
Whereas stringbuilder is muttable. It is exactly opposite to string. Whenever you do any operation on stringbuilder, it will not create new instance.
If you wanted to do lot of string concatenation, its better to use stringbuilder rather than string.