Sollicitatievraag bij DataArt

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

Antwoord op sollicitatievraag

Anoniem

1 jul 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