How to Define a Data Contract for Custom Serialization in WCF?

For the WCF serializer to marshal a complex type, you must define a data contract for it. To do this, start by applying the DataContractAttribute attribute to the complex type definition that you want to pass in a message. Apply the DataMemberAttribute attribute to each field (either a data member or a property) that is to be serialized. All other data fields on the class are ignored.