Thursday, July 30, 2009

string concatenation ( "+=" ) vs StringBuilder in c#

According to the ASP.NET MVC product team, in small sets of concatenation operations, it's faster to use string concatenation i.e. "+=" syntax as opposed to instantiating a StringBuilder. I personally find using "+=" to be more readable than extra lines of new StringBuilder()...stringBuilder.Append(...) and so forth.
The examples from the team's book use the += concatenation approach.

No comments:

Post a Comment