How can I ignore a property when serializing using the DataContractSerializer?

后端 未结 5 1303
你的背包
你的背包 2020-11-27 14:18

I am using .NET 3.5SP1 and DataContractSerializer to serialize a class. In SP1, they changed the behavior so that you don\'t have to include DataContract

5条回答
  •  庸人自扰
    2020-11-27 14:46

    In XML Serializing, you can use the [XmlIgnore] attribute (System.Xml.Serialization.XmlIgnoreAttribute) to ignore a property when serializing a class.

    This may be of use to you (Or it just may be of use to anyone who found this question when attempting to find out how to ignore a property when Serializing in XML, as I was).

提交回复
热议问题