Comparison of. Net serialization classes

Source: Internet
Author: User

Serialization Class Name

MarkSerializableFeature time

MarkDatacontractFeature time

Remarks

Xmlserializer

 Only public fields and attributes can be serialized.,Methods, indexers, private fields, or read-only attributes cannot be serialized.(Except for read-only sets).

Never tried

 

Binaryformatter

All are serialized

 Never tried

 

Datacontractjsonserializer

Only serialize fields (including private fields and public fields). If the attribute does not have a corresponding field, private fields are automatically generated and serialized.

Mark as serialized onlyDatamemberFields or attributes (including private and public)

GenerateJSON

Jsonquerystringconverter

Only serialize fields (including private fields and public fields). If the attribute does not have a corresponding field, a private field is automatically generated for it.

Mark as serialized onlyDatamemberFields or attributes (including private and public)

GenerateJSON

Javascriptserializer

Serialize common fields or attributes

Serialize public fields or attributes, whether or not they are markedDatamember(If the private field is markedDatamemberWill not be serialized. Similarly, if the public field is not markedDatamemberWill also be serialized)

 GenerateJSON(Outdated, this class is abnormal)

Datacontractserializer

Serialize all fields and attributes (including private and common, but markedNoserializableExcept)

Mark as serialized onlyDatamemberFields or attributes (including private and public)

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.