Useful Information on Data Contracts

I’m beginning to learn about the C# attributes [DataContract] and [DataMember]. Data Contracts in C# are a loose set of rules that are defined for a client and server to communicate through, C# has built in Data Contracts defined for default classes such as ints, strings, etc. Before .NET 3.5 SP1 any custom class, structure or enumerable object would require adding an attribute [DataContract] to the object definition; as well as adding [DataMember] to each property that would need to be serialized to XML.

I found a post on stack overflow which brings up a good question, and an even better reply. I feel the original author did a fine job of explaining it, so I felt linking to the post and grabbing a screen shot would do them more justice than paraphrasing.

The original link.


And the response


(Views: 303)

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.