blog post image
Andrew Lock avatar

Andrew Lock

Series: A deep dive on StringBuilder

One of the big focuses in recent versions of .NET has been on performance, reducing allocations in particular. In this series I dig into a class which has been used to reduce allocations all the way back since .NET Framework 1.1: StringBuilder.

Rather than showing how to use StringBuilder (I'm sure most people will be familiar with its basic usage) I'm going to dig into the source code and see how it's implemented. This is a big class, so it will take several posts, but I want to touch on all the interesting features.

After looking at StringBuilder, we'll take a look at two internal optimisation classes used by the framework StringBuilderCache and ValueStringBuilder, and show how those can be used to further reduce allocations.

Andrew Lock | .Net Escapades
Want an email when
there's new posts?