4
Reply

What’s the advantage of using System.Text.StringBuilder over System.String?

Manu

Manu

18y
11k
0
Reply

    by the use of System.Text.stringBuilder we can save memory wastage & time Wastage let we use string without stringBuilder &perform concatenation in loop. for all concatenations objects are created after concatenation buffer are destroyed so we need large memory & time so we use StringBuilder rather than String

    by the use of System.Text.stringBuilder we can save memory wastage & time Wastage let we use string without stringBuilder &perform concatenation in loop. for all concatenations objects are created after concatenation buffer are destroyed so we need large memory & time so we use StringBuilder rather than String

    Basically, use a string builder if you plan on doing a lot of concatenation operations. It will save you some time and memory when executing (which is especially handy if you run that code snippet a lot, or if you are running on a web server, for instance).

    StringBuilder is more efficient in the cases, where a lot of manipulation is done to the text. Strings are immutable, so each time it’s being operated on, a new instance is created.