title: Dataset XML serialization to memory stream
body: <p>I have a strongly typed DataSet and a corresponding class generated with xsd.exe.</p>
  
  <p>I wanted to pass DataSet content to the matching class with XML serialization/deserialization.</p>
  
  <p>If I use something like:</p>
  
  <pre><code>MyStronglyTypedDataSet ds = new MyStronglyTypedDataSet();
  //... fill the dataset...
  ds.WriteXml(@"C:\Temp\somedata.xml");
  
  FileStream fs = new FileStream(@"C:\Temp\somedata.xml", FileMode.Open);
  XmlSerializer serial = new XmlSerializer(typeof(MyDataSetMatchingClass));
  MyDataSetMatchingClass myObj = (MyDataSetMatchingClass)serial.Deserialize(fs);
  </code></pre>
  
  <p>Everything works fine, but I don't want to use a temporary file so I tried:</p>
  
  <pre><code>MyStronglyTypedDataSet ds = new MyStronglyTypedDataSet();
  //... fill the dataset...
  MemoryStream dump = new MemoryStream();
  ds.WriteXml(dump);
  
  XmlSerializer serial = new XmlSerializer(typeof(MyDataSetMatchingClass));
  MyDataSetMatchingClass myObj = (MyDataSetMatchingClass)serial.Deserialize(dump);
  </code></pre>
  
  <p>But the deserializer complains that root XML node is missing. Anyone knows a way to tell the XmlWriter to append the root node, or the deserializer to ignore missing root node or any other solution?</p>