Frage im Vorstellungsgespräch bei DataArt

What is the difference between String and System.Text.StringBuilder?

Antwort im Vorstellungsgespräch

Anonym

1. Juli 2015

A string instance is immutable. You cannot change it after it was created. Any operation that appears to change the string instead returns a new instance. When you need a mutable string, such as one you're contructing piece-wise or where you change lots of things, then you'll need a StringBuilder which is a buffer of characters that can be changed.

1