title: C# convert Exception Object to an XML document
body: <p>I am wanting to be able to create an XML document to save to a SQL database from an Exception object. Is there a way to easily convert an exception object into an XML document? I want to be able to do something like:</p>
  
  <pre><code>public void WriteError(Exception ex)
  {
      var doc = new XmlDocument();
      doc.Load(ex);
      sql.Insert(doc);
  }
  </code></pre>