Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6754845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:19:47+00:00 2026-05-26T13:19:47+00:00

I’ve worked with WCF for awhile now and in places where both client and

  • 0

I’ve worked with WCF for awhile now and in places where both client and server tend to be co-released; that is, new versions have almost always been released at the same time. Interoperability and versioning aren’t issues (in this case at least).

The MSDN documentation, DataMemberAttribute.EmitDefaultValue and Data Contract Versioning, suggests it is a bad practice to emit the default value unless there is a specific need and to support versioning.

In practice, I’ve found it useful and at times critical to omit the default value, especially when a WCF service must call back multiple clients. At times of high load, the bigger messages place high memory pressure on the server and take longer to transmit.

Are there any other reasons why this should be avoided?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:19:48+00:00Added an answer on May 26, 2026 at 1:19 pm

    I am also using DataMemberAttribute.EmitDefaultValue = false in some spots to try and limit the amount of data being transmitted. In my case, I am in control of both the client and server side of things, so I don’t have any problems with it.

    I did find a reference to a potential conflict with DataMemberAttribute.IsRequired, which I didn’t know about before:

    Interaction with IsRequired

    …If IsRequired is set to
    true, (which indicates that a value must be present) and
    EmitDefaultValue is set to false (indicating that the value must not
    be present if it is set to its default value), default values for this
    data member cannot be serialized because the results would be
    contradictory. If such a data member is set to its default value
    (usually null or zero) and a serialization is attempted, a
    SerializationException is thrown.

    Normally, this shouldn’t be a problem because as soon as you try to serialize an object with a member marked with EmitDefaultValue = false, IsRequired = true, and a default value, you get a SerializationExeception, so the problem is very obvious (I just tested it out). However, I could see situations where the EmitDefaultValue is false and at some later time, IsRequired is set to true, creating problems (hopefully caught in testing before the change is deployed).

    One more possible problem with this combination: a client could send data with a default value, and this will be deserialized without a problem. Your service might then save it to the database, and then attempt to send it back out, which will throw an exception.

    All that being said, I think you are using the setting for the specific reasons noted in the documentation. Just be aware of the potential conflict with IsRequired.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a small JavaScript validation script that validates inputs based on Regex. I
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.