title: Serializing a .NET EventLogEntry instance to XML
body: <p>When using the Event Viewer in Windows 7, there is a separate 'XML View' of an event that can be accessed from the Event Properties dialog. This XML refers to the <code>http://schemas.microsoft.com/win/2004/08/events/event</code> namespace.</p>
  
  <p>When I subscribe to Windows Events using the .NET framework classes in the <code>System.Diagnostics</code>namespace and retrieve event objects in the form of <code>EventLogEntry</code> instances, is there a way to serialize these instances to the XML format mentioned above? I can not seem to find any.</p>
  
  <p>Thank you very much for your response. </p>
  
  <p><strong>Update</strong>: thanks to jmservera I have found out there is a different and better API in the <code>System.Diagnostics.Eventing.Reader</code> namespace, however this API does not support deployment to Windows Server 2003/ XP.</p>
  
  <p><strong>Update 2</strong>: I have accepted jmservera's answer, because it has lead me to the solution. If you are targetting Vista/ Windows Server 2008 follow jmservera's suggestion and use the API in the newer namespace. If, however, you need to support previous OS's you will have to use the older API and serialize the EventLogEntry to XML yourself.</p>