title: How to solve "Both use the XML type name X, use XML attributes to specify a unique XML name and/or namespace for the type"?
body: <p>I have the following enum definitions...</p>
  <pre><code>namespace ItemTable
  {
    public enum DisplayMode
    {
      Tiles,
      Default
    }
  }
  
  namespace EffectiveItemPermissionTable
  {
    public enum DisplayMode
    {
      Tree,
      FullPaths
    }
  }
  </code></pre>
  <p>...and then i have the following classes...</p>
  <pre><code>public class Table&lt;TDisplayMode&gt;
    where TDisplayMode: struct
  {
    // public
      public TDisplayMode DisplayMode
      { 
        get { return mDisplayMode; }
        set { mDisplayMode = value; }
      }
  
    // private
      private TDisplayMode mDisplayMode;
  }
  
  public class ItemTable : Table&lt;ItemTable.DisplayMode&gt;
  {}
  
  public class EffectiveItemPermissionTable : Table&lt;EffectiveItemPermissionTable.DisplayMode&gt;
  {}
  
  public class UISettings
  {
    public UISettings()
    {
      ItemTable = new ItemTable();
      EffectiveItemPermissionTable = new EffectiveItemPermissionTable();
    }
  
    public ItemTable ItemTable { get; set; }
    public EffectiveItemPermissionTable EffectiveItemPermissionTable { get; set; }
  }
  </code></pre>
  <p>...and when i try to serialize an instance of UISettings with...</p>
  <pre><code>System.Xml.Serialization.XmlSerializer lSerializer =
    new System.Xml.Serialization.XmlSerializer(typeof(UISettings));
  </code></pre>
  <p>...i get the following error:</p>
  <pre><code>Types 'UISettings.Table`1[EffectiveItemPermissionTable.DisplayMode]' and
  'UISettings.Table`1[ItemTable.DisplayMode]' both use the XML type name,
  'TableOfDisplayMode', from namespace ''.
  
  Use XML attributes to specify a unique XML name and/or namespace for the type.
  </code></pre>
  <p>I have tried to use XmlType attribubtes and all sorts of solutions posted on the web but nothing works. The XML type name is always <code>TableOfDisplayMode</code> as mentioned in the error.</p>
  <p>The only solution right now is to rename one of the enums, e.g. to <code>DisplayMode_</code> but I find that rather ugly.</p>