Reputation: 150198
I understand that DataContractSerializer
is opt-in... properties or fields that should be serialized are decorated with DataMemberAttribute
.
Is there a standard, or at least common, method to succinctly indicate (to another programmer, not to the compiler) that a property should NOT be part of the data contract?
The XmlSerializer
has XmlIgnore
(out of necessity, since it is an opt-out serializer). Hibernate has a transient
annotation.
What's the best approach to document for future maintainers "yes, indeed, I meant to leave off the DataMember
attribute"?
Upvotes: 2
Views: 195
Reputation: 2305
If I understand you correctly, the IgnoreDataMemberAttribute
is what you want.
http://msdn.microsoft.com/en-us/library/system.runtime.serialization.ignoredatamemberattribute.aspx
Hope this helps. Nate
Upvotes: 3