问题
I have a class that is serializing very nicely - finally!
Now I want to add a property to this class, that I don't want to be serialized at all.
Is it possible to add this new property with some kind of attribute so that when I call serialize or deserialize methods, this property will go unnoticed?
回答1:
[XmlIgnore]
public int DoNotSerialize { get { ... } set { ... } }
回答2:
I think your looking for [XmlIgnore] attribute
来源:https://stackoverflow.com/questions/1198910/ignoring-a-property-during-deserialization