How does DataContractSerializer write to private fields?

Posted by Eric on Stack Overflow See other posts from Stack Overflow or by Eric
Published on 2010-04-03T20:06:23Z Indexed on 2010/04/03 20:13 UTC
Read the original article Hit count: 596

I understand how XMLSerializer could work by using reflection to figure out what public read/write fields or properties it should be using to serialize or de-serialize XML. Yet XMLSerializer requires that the fields be public and read/write.

However, DataContractSerializer is able to read or write to or from completely private fields in a class. So I'm wondering how this is even possible with out explicitly giving DataContractSerializer additional access rights to my class(es).

© Stack Overflow or respective owner

Related posts about xmlserializer

Related posts about datacontractserializer