Create a low allocation and faster StringBuilder - Span in Action
.NET ships a nice
StringBuilder since the dawn of time or at least since the beginning of the framework itself. The intention is simple: If we need to concatenate a lot of strings we can't rely on the
+ operator as we introduce a lot of unnecessary allocations plus it is slow!
That is where the
StringBuilder jumps into the picture.
Why is that? Why is the
StringBuilder better? And can we do better? Spoiler: Yes!