title: XML serialize Error: the type system.string may not be used in this context
body: <p>I have a WORK CLASS:</p>
  
  <pre><code>public partial class WORK
  {
      Public WORK()
      {
          oId= new List&lt;WORKID&gt;();
      }
      // I have got WORKID obj in constructor &amp; Get, Set variables...
  
      [System.Xml.Serialization.XmlElementAttribute("WORKID")]
      public List&lt;WORKID&gt; WORKID
      {
          get{}
          set{}
      }
  }
  
  [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.34234")]
  [System.SerializableAttribute()]
  [System.ComponentModel.DesignerCategoryAttribute("code")]
  [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
  public partial class WORKID
  {
      public string SERVICEORDERNO{}
      public string TECH{}
      public object APPOINTMENT{}
      //etc...
  }
  </code></pre>
  
  <p>In Main class...</p>
  
  <pre><code>WORID owork = new WORKID();
  //assigned 
  </code></pre>
  
  <p>all the values to WORKID class and its Related Class.</p>
  
  <p>Now the error is when serialize </p>
  
  <pre><code>var xmlserializer = new XmlSerializer(typeof(WORK));
  using (var writer = new StreamWriter(@"C:\Users\user1\Desktop\out.xml"))
        {
            xmlserializer.Serialize(writer, owork);
        }
  </code></pre>
  
  <p>Exception: </p>
  
  <blockquote>
    <p>The type System.String may not be used in this context.</p>
  </blockquote>
  
  <p>Any help is appreciated.</p>