When to use String vs. StringBuilder in .NET Core
Two popular classes that you will use frequently when working with strings in .NET Core are the String and StringBuilder classes. You should be aware of the best practices when using both these classes to build applications that minimize allocations and are highly performant. This article discusses the best practices we can follow when working with strings in C#.To work with the code examples provided in this article, you should have Visual Studio 2019 installed in your system. If you don’t already have a copy, you can download Visual Studio 2019 here. Note we’ll also use BenchmarkDotNet to track performance of the methods. If you’re not familiar with BenchmarkDotNet, I suggest reading this article first.To read this article in full, please click here
Two popular classes that you will use frequently when working with strings in .NET Core are the String and StringBuilder classes. You should be aware of the best practices when using both these classes to build applications that minimize allocations and are highly performant. This article discusses the best practices we can follow when working with strings in C#.
To work with the code examples provided in this article, you should have Visual Studio 2019 installed in your system. If you don’t already have a copy, you can download Visual Studio 2019 here. Note we’ll also use BenchmarkDotNet to track performance of the methods. If you’re not familiar with BenchmarkDotNet, I suggest reading this article first.