title: Saving XElement to a byte array
body: <p>I have following piece of code, it writes some data but not all. What can cut my data ?</p>
  
  <pre><code>using (var stream = new MemoryStream())
  {
      XmlTextWriter xwr = new XmlTextWriter(stream, Encoding.UTF8);
      service.getXElement.WriteTo(xwr);
      byte[] bytes = stream.ToArray();
      writeStream.Write(bytes, 0, bytes.Length);
  }
  </code></pre>