discussing the basics of string earlier, I mentioned how each time you
try to append a string to an existing string, a new string gets
string hello_world = "hello world";
string hello_world2 = hello_world + "there"
The second statement actually creates two new strings to make "hello world there"
What if you do something like this
hello_world_2 = hello_world2 + hello_world;
By the time the loop finishes, a 100 string objects would have been created. That is crazy and is not practical in many scenarios. In fact I cannot imagine any scenario when this would be considered appropriate.
When you are doing something like this, you use a StringBuilder, as the name suggests, maintains a buffer internally. So, when you append a string, it will join the buffer instead of creating a new string.