title: How to serialize/deserialize a C# WCF DataContract to/from XML
body: <p>I am developing a WCF service which will be consumed by multiple different client applications. In order to make one functionality work, the server needs to read an XML file into a C# DataContract which is then passed on to the concerned client. As far as I understand from the MSDN website, this is possible but I couldn't find any complete examples. In particular, the website talks about a 'stream' parameter which I don't quite get yet.</p>
  
  <p>My data contract has one property field which is a list of another data contract which has multiple simple property fields.</p>
  
  <p>e.g.</p>
  
  <pre><code>    [DataContract]
      public class MyClass1 {
          [DataMember]
          public string name;
          [DataMember]
          public int age;
      }
  
      [DataContract]
      public class MyClass2 {
          [DataMember]
          public List&lt;MyClass1&gt; myClass1List;
      }
  </code></pre>
  
  <p>My classes look something like this.</p>