Serialization in Windows Communication Foundation
In some situations serialization is required for persisting state of objects from WCF services. Starting with .NET Framework 3.0, you can serialize objects exposed by WCF services using the
DataContractSerializer class (which inherits from
XmlObjectSerializer). The usage of such a class is not so different from other serialization classes. The only need is that you must mark your serializable classes either with the
Serializable or with the
DataContract attribute and, in this case, their members with the
DataMember attribute. To see how this works in code, create a new WCF service project within Visual Studio 2015 (refer to Chapter 37, “Creating and Consuming WCF Services,” for a recap) and name ...