I’m using attribute-free DataContract serialization (.NET 3.5 SP 1).
I want change EmitDefaultValue to false for all my DataContracts.
How I can achieve this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you want to use the
EmitDefaultValueproperty on theDataMemberAttributethat you apply to a property, then you will have to apply theDataContractAttributeto the type.This has the unfortunate side-effect of having to place the
DataMemberAttributeattribute on all members of the type that you wish to serialize (the ones you were assuming before you used attribute-free Data Contract serialization) due to the nature of Data Contract serialization being all-in when using the attributes.