c# - What are the advantages of using [DataContract] rather than [Serializable] in WCF -


any advantage using datacontract?

see great comparison of xmlserializer , datacontractserializer on dan rigsby's blog.

some points in favor of datacontractserializer:

  • about 10% faster xmlserializer
  • will serialize decorated [datamember] - if it's not public visible
  • will not serialize unless tell ("opt-in")
  • you can define order in elements serialized using order= attribute on [datamember]
  • doesn't require parameterless constructor deserialization

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -