Ignore a property during xml serialization but not during deserialization
问题 In C#, how can I make XmlSerializer ignore a property during serialization but not during deserialization? (Or how do I do the same with Json.net?) To prevent a property from being serialized, you can add the XmlIgnore attribute: [XmlIgnore] public int FooBar {get;set;} This will cause the <FooBar> tag to be omitted during serialization. However, this also means that the <FooBar> tag will be ignored during deserialization. In my case, I accept an array of items from user in the request, and