How does StringBuilder work?
What does it do internally? Does it use unsafe code?
And why is it so fast (compared to the + opera
The Microsoft CLR does do some operations with internal call (not quite the same as unsafe code). The biggest performance benefit over a bunch of + concatenated strings is that it writes to a char[] and doesn't create as many intermediate strings. When you call ToString (), it builds a completed, immutable string from your contents.