title: Dataset Write to a file
body: <p>I've got a <code>DataSet</code> with <code>600K records</code>.<br/>When I try to write those data to a <code>XML</code> file I get <code>OutOfMemoryException</code> always.<br/>
  Below is how I write data at the moment. 
  <br/><br/>What is the <strong>most memory efficient</strong> way to do this?</p>
  
  <pre><code>using (MemoryStream output = new MemoryStream())
  {
      WorkingDataset.WriteXml(output, XmlWriteMode.WriteSchema);
      using (FileStream outputFile = File.Create(FilePath))
      {
           using (GZipStream compressedStream = new GZipStream(outputFile, CompressionMode.Compress))
           {
          compressedStream.Write(output.GetBuffer(), 0, (int)output.Length);
           }
          }
    }
  </code></pre>