title: Adding C# attribute to wsdl.exe generated property?
body: <p>I have a class which is automatically generated via wsdl.exe, I need to add the <strong>[System.Xml.Serialization.XmlIgnoreAttribute()]</strong> attribute to one of the properties, but I can't modify the class directly as it is regenerated every now and then.</p>
  
  <p>Is there any way to do this? I already tried searching for solutions with inheritance, partial classes and reflection but without luck.
  I'm stuck with .NET Framework 2.0 because of customer's constraints.</p>
  
  <p>(more details on why I need to do this here: <a href="https://stackoverflow.com/questions/3188933/prevent-timezone-conversion-on-deserialization-of-datetime-value">Prevent timezone conversion on deserialization of DateTime value</a>, I'm adding the string property in a partial class)</p>
  
  <p>EDIT: A requested code snippet is a simple as this:</p>
  
  <pre><code>[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
  [System.SerializableAttribute()]
  [System.Diagnostics.DebuggerStepThroughAttribute()]
  [System.ComponentModel.DesignerCategoryAttribute("code")]
  [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://common.ws.model.plx.ids.it/")]
  public partial class publication {
      private System.DateTime dateFromField;
  
      //[System.Xml.Serialization.XmlIgnoreAttribute()] I would like to add this
      [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
      public System.DateTime dateFrom {
          get {
              return this.dateFromField;
          }
          set {
              this.dateFromField = value;
          }
      }
  
      ///// This method has been moved in the other partial class
      //[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, ElementName = "dateFrom")]
      //public string dateFromString
      //{
      //    get
      //    {
      //        return XmlConvert.ToString(dateFrom, XmlDateTimeSerializationMode.RoundtripKind);
      //    }
      //    set
      //    {
      //        dateFrom = DateTimeOffset.Parse(value).DateTime;
      //    }
      //}
  }
  </code></pre>