A mutable object can be changed after it's created, and an immutable object can't.
In C#, mutable types, like lists, can be modified:
Immutable types, like tuples, can't be changed:
Strings can be mutable or immutable depending on the language.
Strings are immutable in C#.
When you modify a string, you're actually creating a separate copy, leaving the first intact:
But in some other languages, like C++, strings can be mutable:
If you want mutable strings in C#, you can use a StringBuilder object:
Or, you can convert the string to an array of characters, which will be mutable.
Mutable objects are nice because you can make changes in-place, without allocating a new object. But be careful—whenever you make an in-place change to an object, all references to that object will now reflect the change.
Interview Cake