String in C#
What is the purpose of using System.Text.StringBuilder over System.String?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Posted Jun 26, 2012, 3:52 AM EDT
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.
Santhosh Kumar JayaramanRank #563 · 4.3K reputationPosted Jun 26, 2012, 3:54 AM EDT
http://www.c-sharpcorner.com/UploadFile/8832bd/string-vs-stringbuilder-in-net/
Jignesh TrivediRank #16 · 50.3K reputationPosted Jun 26, 2012, 5:04 AM EDT
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.