title: C# XmlSerializer xmlns in child element matching parent
body: <p>I'm using XmlSerializer to create a xml doc in use for ebay's large merchant services.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
  &lt;BulkDataExchangeRequests xmlns="urn:ebay:apis:eBLBaseComponents"&gt;
      &lt;Header&gt;
          &lt;SiteID&gt;0&lt;/SiteID&gt;
          &lt;Version&gt;775&lt;/Version&gt;
      &lt;/Header&gt;
      &lt;AddFixedPriceItemRequest xmlns="urn:ebay:apis:eBLBaseComponents"&gt;
  &lt;Version&gt;775&lt;/Version&gt;
  
  &lt;Item&gt;
      &lt;AutoPay&gt;false&lt;/AutoPay&gt;
      &lt;BuyerProtection&gt;ItemIneligible&lt;/BuyerProtection&gt;
      &lt;BuyItNowPrice currencyID="USD"&gt;0.0&lt;/BuyItNowPrice&gt;
      &lt;Country&gt;US&lt;/Country&gt;
      &lt;Currency&gt;USD&lt;/Currency&gt;
      &lt;Description&gt;test&lt;/Description&gt;
      &lt;GiftIcon&gt;0&lt;/GiftIcon&gt;
  &lt;/Item&gt;
  &lt;/AddFixedPriceItemRequest&gt;
  &lt;/BulkDataExchangeRequests&gt;
  </code></pre>
  
  <p>The problem I'm having is getting the AddFixedPriceItemRequest generated by the serializer to actually contain that xmlns like the BulkDataExchangeRequests element has.  It seems to be a requirement in order for this to work. I generate the bulk tag using:</p>
  
  <pre><code>writer.WriteStartElement("BulkDataExchangeRequests", "urn:ebay:apis:eBLBaseComponents");
  </code></pre>
  
  <p>I create a serializer.</p>
  
  <pre><code>serializer = new XmlSerializer(typeof(AddFixedPriceItemRequestType));//, "urn:ebay:apis:eBLBaseComponents");
  </code></pre>
  
  <p>and serialize with the namespace</p>
  
  <pre><code>request = new AddFixedPriceItemRequestType()
  {
  //populate data.
  };
  
  XmlSerializerNamespaces namespaces = new XmlSerializerNamespaces();
  namespaces.Add("", "urn:ebay:apis:eBLBaseComponents");
  
  serializer.Serialize(writer, request, namespaces);
  </code></pre>
  
  <p>This is the type with the xml attributes:</p>
  
  <pre><code>[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.5420")]
  [System.SerializableAttribute()]
  [System.Diagnostics.DebuggerStepThroughAttribute()]
  [System.ComponentModel.DesignerCategoryAttribute("code")]
  [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:ebay:apis:eBLBaseComponents",TypeName="AddFixedPriceItemRequest")]
  public partial class AddFixedPriceItemRequestType : AbstractRequestType {
  //filled in class
  }
  </code></pre>
  
  <p>my output ends up like this:</p>
  
  <pre><code>&lt;AddFixedPriceItemRequest xmlns=""&gt;
     &lt;ErrorLanguage xmlns="urn:ebay:apis:eBLBaseComponents"&gt;en_US&lt;/ErrorLanguage&gt;
      &lt;Version xmlns="urn:ebay:apis:eBLBaseComponents"&gt;837&lt;/Version&gt;
      &lt;Item p4:type="Item" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:ebay:apis:eBLBaseComponents"&gt;
  </code></pre>
  
  <p>Could someone help out with how to get xmlns of addfixedpriceitemrequest set to match the bulk xmlns via the serializer.  Or recommend another way to do it.  I was trying to avoid writing each property out with createelement/writeelement.</p>