How to work with String.Create in C#
String handling is one of the most performance-critical areas in any application. Because strings are immutable, you can very easily accumulate many string objects very quickly, resulting in memory resource allocations that will impact application performance adversely.When you add strings or extract substrings from a string, new string instances are created. Same goes when you perform operations such as string concatenation, which creates new string objects rather than reusing existing ones. We’ve seen how we can take advantage of the StringBuilder class when concatenating strings to reduce the number of string instances created and also reduce the allocations.To read this article in full, please click here
String handling is one of the most performance-critical areas in any application. Because strings are immutable, you can very easily accumulate many string objects very quickly, resulting in memory resource allocations that will impact application performance adversely.
When you add strings or extract substrings from a string, new string instances are created. Same goes when you perform operations such as string concatenation, which creates new string objects rather than reusing existing ones. We’ve seen how we can take advantage of the StringBuilder class when concatenating strings to reduce the number of string instances created and also reduce the allocations.