c# - Serialize/deserialize objects - order of fields matters? -


Is it possible that DataContractSerializer incorrectly destlicates an object if the field is "correct" "(Which also means) order?

The classes I try to serialize do not have order-attributes on the field / property. Nevertheless, one of my fields should always be of null It is deserialized in the form, even if it has a non-empty value (it is actually a list of strings).

When I started to work two XML elements serial file to match the sequence in another XML instance (for which the work was done without deserialization problem) everything worked.

It does not make sense to me, but maybe someone knows better than DataContractSerializer to be eligible for correct serialization / serialization,

< P>
  1. The serial should be in the serializable attribute or DataContractAttribute must be set
  2. The properties and fields which are serialized field need to set DataMemberAttribute Land;
  3. The serializable property or field must have a datatype serialized jazz (i.e., the heir of a public CTOr and iasarias);
  4. The class must be sorted IExtensibleDataObject ;
  5. Note: Serializable fields can be either public or private.
  6. Or you should use the DataMemberAttribute .

Therefore, does the order of the declaration. If the members are not in alphabetical order, they are omitted. Look, maybe this applies to your case.


Comments