Hacker News new | ask | show | jobs
by WillBAnders 2048 days ago
This is an interesting question, I was not aware of this behavior in C#. It looks like the solution is to use annotations to specify a property as being ignored.

The intended behavior is to serialize all fields of an object (some properties have backing fields, others don't). You wouldn't serialize properties themselves for the same reason a getter/setter on it's own wouldn't be serialized - only the data stored.

Put simply, I would say C# has the wrong default behavior here.