Search code examples
c#stringbuilder

When to use StringBuilder?


I understand the benefits of StringBuilder.

But if I want to concatenate 2 strings, then I assume that it is better (faster) to do it without StringBuilder. Is this correct?

At what point (number of strings) does it become better to use StringBuilder?


Solution

  • I warmly suggest you to read The Sad Tragedy of Micro-Optimization Theater, by Jeff Atwood.

    It treats Simple Concatenation vs. StringBuilder vs. other methods.

    Now, if you want to see some numbers and graphs, follow the link ;)