title: C#, insert strongly typed object into XML Document as Element
body: <p>I have an XML document that contains the following structure:</p>
  
  <p>Its more or less a collection of Events: </p>
  
  <pre><code>&lt;Events&gt;
    &lt;Event&gt;
      &lt;DateTime&gt;&lt;/DateTime&gt;
      &lt;EventType&gt;&lt;/EventType&gt;
      &lt;Result&gt;&lt;/Result&gt;
      &lt;Provider&gt;&lt;/Provider&gt;
      &lt;ErrorMessage&gt;&lt;/ErrorMessage&gt;
      &lt;InnerException&gt;&lt;/InnerException&gt;
    &lt;/Event&gt;
  &lt;/Events&gt;
  </code></pre>
  
  <p>In C# I have a persistent object called Event:</p>
  
  <p>Now given that the document already exists, and saved to file... I call :</p>
  
  <pre><code>        XmlDocument xmlDoc = new XmlDocument();
          xmlDoc.Load(dataPath);
  </code></pre>
  
  <p>Now how can I add a new Event item to events?</p>
  
  <p>I've got a strongly typed Event item in my C# code, and want it inserted into the Events collection in the XML object as last child.</p>
  
  <p>I guess this is what I am really asking : <a href="https://stackoverflow.com/questions/1457033/c-insert-a-strongly-typed-object-as-node-in-existing-xml-document">https://stackoverflow.com/questions/1457033/c-insert-a-strongly-typed-object-as-node-in-existing-xml-document</a></p>