tags:

views:

12

answers:

1

Hi All,

Can anyone please elabortae me the reasons why should I use Data Contract Serializer while we have XML/Binary serializer already there in .Net ?

A: 

This is a site i found when i was looking into the same issue. You should check this out

Quoting from the same link mentioned above:

Advantages of DataContractSerializer over XMLSerializer

  1. Opt-in rather than opt-out properties to serialize.
  2. Because it is opt in you can serialize not only properties, but also fields. You can even serialize non-public members such as private or protected members. And you dont need a set on a property either (however without a setter you can serialize, but not deserialize)
  3. Is about 10% faster than XmlSerializer to serialize the data because since you don’t have full control over how it is serialize, there is a lot that can be done to optimize the serialization/deserialization process.
  4. Can understand the SerializableAttribute and know that it needs to be serialized
  5. More options and control over KnownTypes

Hope it helps!

InSane