Ignoring a property during deserialization

做~自己de王妃 提交于 2020-01-14 08:44:38

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!