Serialise specific properties only #718
-
Supposing these types: public class Parent
{
public int Foo { get; set; }
public bool Bar { get; set; }
}
public class Chid
{
public Parent Parent { get; set; }
public string Baz { get; set; }
public int Qux { get; set; } // serialise this
public string Spam { get; set; }
public bool Ham { get; set; } // serialise this
public double Eggs { get; set; } // serialise this
} If I serialise How do I serialise specific properties only? For example: (I don't want to specify which properties to "exclude", but rather those to "include".) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
To restate what you're looking for, to make sure I understand clearly, is to make it so by default nothing would get serialized unless there was an attribute on the property? The opposite of the way it currently is. Is that right? I believe the only way we can exclude things is by decorating the properties you want to exclude with the |
Beta Was this translation helpful? Give feedback.
To restate what you're looking for, to make sure I understand clearly, is to make it so by default nothing would get serialized unless there was an attribute on the property? The opposite of the way it currently is. Is that right?
I believe the only way we can exclude things is by decorating the properties you want to exclude with the
YamlIgnore
attribute.