title: Is XmlRootAttribute inheritable?
body: <p>I have a class I am serializing with C#'s <a href="http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.aspx" rel="noreferrer">XmlSerializer</a>. It is marked with the <a href="http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlrootattribute.aspx" rel="noreferrer">XmlRoot</a> attribute, and I would like to inherit this attribute in a derived class.</p>
  
  <p>Looking at the documentation it does not say that XmlRoot sets Inherit to false with AttributeUsageAttribute (Inherit is supposed to default to true), but I get an error when trying to deserialize my inherited class without an XmlRoot attribute ("&lt;rootNode xmlns=''&gt; was not expected.").</p>
  
  <p>This currently works:</p>
  
  <pre><code>[Serializable()]
  [XmlRoot("rootNode")]
  public class BaseClass
  {
      [XmlAttribute("attributeA")]
      public int A { get; set; }
  }
  
  [Serializable()]
  [XmlRoot("rootNode")]
  public class InheritedClass : BaseClass
  {
      [XmlElement("elementB")]
      public int B { get; set; }
  }
  </code></pre>
  
  <p>This does not work, but is what I want:</p>
  
  <pre><code>[Serializable()]
  [XmlRoot("rootNode")]
  public class BaseClass
  {
      [XmlAttribute("attributeA")]
      public int A { get; set; }
  }
  
  [Serializable()]
  public class InheritedClass : BaseClass
  {
      [XmlElement("elementB")]
      public int B { get; set; }
  }
  </code></pre>
  
  <p>The XML I might try to deserialize as a <code>InheritedClass</code> looks like this:</p>
  
  <pre><code>&lt;rootNode attributeA="abc"&gt;
      &lt;elementB&gt;123&lt;/elementB&gt;
  &lt;/rootNode&gt;
  </code></pre>