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

后端 未结 5 1306
你的背包
你的背包 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:55

    Try marking the field with [NonSerialized()] attribute. This will tell the serializer to ignore the field.

    https://msdn.microsoft.com/en-us/library/system.nonserializedattribute(v=vs.110).aspx

提交回复
热议问题