Nugget 4: StringBuilder Keeps Its Crown

 

String interpolation was introduced in C# version 6.  In this Nugget I wanted to benchmark string concatenation using the plus (+) operator, StringBuilder append, and string interpolation.  For this test, I used a variation of the class used by Tim Corey in his video "Intro to Benchmark.net - How To Benchmark C# Code".

Based on the benchmark result using BenchmarkDotNet sown below, it is clear to me that StringBuilder is still king!


References:

Comments

Popular posts from this blog

Nugget 11: Adding Filtering to a Blazor QuickGrid

Nugget 9: Building a JobBank App using Blazor. A Nugget with a Story.

Nugget 14: Connection to MongoDB Atlas - SSL Alert 80