Difference between NonSerialized and Xml.Serialization.XmlIgnore?

后端 未结 1 1235
星月不相逢
星月不相逢 2020-12-15 06:52

We\'re serializing/deserializing a class from XML but there are properties and fields in the class which we want to exclude.

The System.NonSerialized

相关标签:
1条回答
  • NonSerialized applies to more types of serialization than XML. You would use NonSerialized if you were serializing to binary or SOAP, and XmlIgnore if you were strictly serializing to XML using an XmlSerializer. See the remarks section of the NonSerializedAttribute class at MSDN.

    0 讨论(0)
提交回复
热议问题