title: How to serialize an object collection / dictionary into <key>value</key>
body: <p>Is there a way to serialize key/value pairs (preferably strongly typed, but possibly also sourced from a Dictionary) into the desired format below?</p>
  
  <pre><code>public List&lt;Identifier&gt; Identifiers = new List&lt;Identifiers&gt;();
  
  public class Identifier
  {
      public string Name { get; set; }
      public string Description { get; set; }
  }
  </code></pre>
  
  <p>This normally serializes to the following:</p>
  
  <pre><code>&lt;Identifiers&gt;
    &lt;Identifier&gt;
      &lt;Name&gt;somename&lt;/Name&gt;
      &lt;Description&gt;somedescription&lt;/Description&gt;
    &lt;/Identifier&gt;
    &lt;Identifier&gt;
      ...
    &lt;/Identifier&gt;
  &lt;/Identifiers&gt;
  </code></pre>
  
  <p>The other possible approach we were thinking about is to use a hashtable/dictionary:</p>
  
  <pre><code>public Dictionary&lt;string, string&gt; Identifiers = new Dictionary&lt;string,string&gt;
  {
      { "somename", "somedescription"},
      { "anothername", "anotherdescription" }
  };
  </code></pre>
  
  <p>But this will either require a custom serialized Dictionary, or a custom <code>XmlWriter</code>.</p>
  
  <p>The output we would like to achieve is:</p>
  
  <pre><code>&lt;Identifiers&gt;
    &lt;somename&gt;somedescription&lt;/somename&gt;
    &lt;anothername&gt;anotherdescription&lt;/anothername&gt;
  &lt;/Identifiers&gt;
  </code></pre>
  
  <p>So we're looking for code samples as to how best approach this to get the output we desire.</p>
  
  <p>Edit: Maybe I should explain better. We already know how to serialize objects. What we are looking for is the answer to a particular type of serialization... I'll expand the question above</p>