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

  • SEARCH
  • Home
  • 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 932353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:39:14+00:00 2026-05-15T20:39:14+00:00

Is it possible that DataContractSerializer wrongly deserializes an object if the fields are not

  • 0

Is it possible that DataContractSerializer wrongly deserializes an object if the fields are not in the “correct” (whatever that means) order?

The classes that I try to serialize/deserialize do not have order-attributes placed on fields/properties. Yet one of my fields always gets deserialized as null even though it has a non-null value (it actually contains a list of strings).

When I moved two XML elements in serialized file around to match the order in another XML example (for which deserialization worked without problems) everything started to work.

This makes no sense to me but maybe someone knows better. 😉

  • 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-15T20:39:15+00:00Added an answer on May 15, 2026 at 8:39 pm

    To be eligible for correct serialization / serialization by the DataContractSerializer, all of the following must be true.

    1. The class that must be serialized must have SerializableAttribute or DataContractAttribute set;
    2. The properties and fields of the class that must be serialized require the DataMemberAttribute set;
    3. The datatype of the serializable property or field must be serializable (i.e., have a public ctor and inherit ISerializable);
    4. The class that must be serialized must implement IExtensibleDataObject;
    5. Note: serializable fields can be either public or private.
    6. Members must be in alphabetical order or you should use the Order-property of the DataMemberAttribute.

    So, the order of the declaration does matter. If members are not in alphabetical order, they are skipped. Look up this answer at StackOverflow for an example, perhaps it applies to your case.

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

Sidebar

Related Questions

In need to serialize an object and it's possible that the assembly version changed
It is quite possible that I may not have got the point, but I
It's possible that I'm not really understanding how git works here, but I have
is it possible that OnTextChanged= event is not executed when!Page.IsPostBack command is executed?
It's possible that I'm not really understanding how git works here, but I have
How is that possible that it is allowed to delete object with private destructor
Is it not possible that foreign key(single column) in a child table references to
When deserializing, DataContractSerializer requires not only that an element name matches, but also that
I am currently trying to serialize an object for a webproject that is hosted
Is it possible that when calling multiple times this function: void Func(String spr, PictureBox

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.