title: Attribute XmlNamespaceDeclarations is ignored during XML serialization
body: <p>I try to serialize an object with custom namespaces. This is how the class looks like:</p>
  
  <pre><code>[XmlRoot("Root", Namespace = "myNamespace")]
  public partial class MyClass
  {
      public MyClass()
      {
          this.Xmlns = new XmlSerializerNamespaces();
          this.Xmlns.Add(string.Empty, "myNamespace");
      }
  
      [XmlNamespaceDeclarations()]
      public XmlSerializerNamespaces Xmlns = null;
  }
  </code></pre>
  
  <p>And here is the code to serialize it:</p>
  
  <pre><code>XmlSerializer serializer = new XmlSerializer(typeof(MyClass));
  serializer.Serialize(xmlWriter, obj);
  </code></pre>
  
  <p>The expected result is</p>
  
  <pre><code>&lt;Root xmlns="myNamespace" /&gt;
  </code></pre>
  
  <p>However it still has xmlns:xsi and xmlns:xsd attributes:</p>
  
  <pre><code>&lt;Root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="myNamespace" /&gt;
  </code></pre>
  
  <p>When I serialize using <code>serializer.Serialize(xmlWriter, obj, obj.Xmlns)</code>, the result is correct. </p>
  
  <p>Why does serializer ignore that <code>XmlNamespaceDeclarations</code> attribute? Shouldn't it automatically take the namespace declarations from it? How can I define namespaces inside serialized class?</p>
  
  <p>Thanks in advance!</p>