Create dynamic XML class
<p>I have a class "MsrProgram" that will serialize. However, if the parameter "Number" in "MsrProgram" is different, i need different parameters in my XML File. What is the easyest way to do somthing like this?</p>

<p>Here is my code:</p>

<pre><code>public class MsrProgram
{
    [XmlAttribute]
    public string OwnerTypeFullName { get; set; }

    [XmlAttribute]
    public int Number { get; set; }

    [XmlAttribute]
    public int MsrRange { get; set; }

    [XmlAttribute]
    public int TurnoverMeasure { get; set; }
}

public class main
{
   var toolList = (from pos in Configuration.List
      select new Position
      {
         ToolNumber = (int)pos.tlno,
         Tool =
         {
            ToolId = pos.tlno.ToString(),
            Step =
            {
               Position = "1",
               MsrProgram =
               {
                  OwnerTypeFullName = "",
                  Number = 1,
                  MsrRange = "1", //When Number is 1
                  TurnoverMeasure = "1", //When Number is 2
               }
            }
         }
      }
}
</code></pre>