title: Uploading DataTable to Azure blob storage
body: <p>I am trying to serialize a DataTable to XML and then upload it to Azure blob storage.</p>
  
  <p>The below code works, but seems clunky and memory hungry. Is there a better way to do this? I'm especially referring to the fact that I am dumping a memory stream to a byte array and then creating a new memory stream from it.</p>
  
  <pre><code>        var container = blobClient.GetContainerReference("container");
          var blockBlob = container.GetBlockBlobReference("blob");
  
          byte[] blobBytes;
          using (var writeStream = new MemoryStream())
          {
              using (var writer = new StreamWriter(writeStream))
              {
                  table.WriteXml(writer, XmlWriteMode.WriteSchema);
  
              }
              blobBytes = writeStream.ToArray();
          }
          using (var readStream = new MemoryStream(blobBytes))
          {
              blockBlob.UploadFromStream(readStream);
          }
  </code></pre>