C# string Vs StringBuilder

In C# String builder is used to represent a mutable string of characters. Mutable means a string that can be changed. So string objects are immutable and String Builder objects are mutable.

In practice what this means is that when you make a change to a string object that has already been instantiated, the compiler would create a new memory allocation for it. This can become very bad if you are doing something like…