title: How do I change the XmlElement name dynamically?
body: <pre><code>[XmlRoot("A")]
  public class Foos
  {
     [XmlElement("A1")]
     public List&lt;Foo&gt; FooList{ get; set; }
  }
  
  
  var serializer = new XmlSerializer(typeof(Foos));
  </code></pre>
  
  <p>This code working as well. But its not dynamic. I want <code>[XmlRoot("A")]</code> to <code>[XmlRoot(ConfigurationManager.AppSettings[someValue])]</code>. But is throw to syntax error. Then i try this</p>
  
  <pre><code>    public class Foos
      {
         [XmlElement("A1")]
         public List&lt;Foo&gt; FooList{ get; set; }
      }
  var serializer = new XmlSerializer(typeof(Foos),new XmlRootAttribute(ConfigurationManager.AppSettings[someValue]));
  </code></pre>
  
  <p>This is work just root element.I'm working. I could not change the "XmlElement" value of the FooList dynamically.There can be more than one element in the class. How do I change the XmlElement value of all of them dynamically? </p>