DEV Community

Discussion on: Encapsulate state and expose behavior when writing object-oriented code

bennchristensen profile image

"They even put a comment on there: This class is mutable. Its data can be modified from outside the class."

No it is not, in C# the field is autogenerated when you use auto-properties.

scottshipp profile image
scottshipp Author

Hi Benn, that's the comment from the Microsoft documentation (linked in the article). The data is mutable because it can be changed. It can be changed from outside the class via the set method. They are right.