title: Disable Serialization for Specific Property
body: <p>I have a class object for XML serialization</p>
  
  <pre><code>[XmlType("PAYMENT")]
  public class PaymentXML
  {
      [XmlElement(ElementName = "REQUEST")]
      public RequestXML Request { get; set; }
  
      [XmlElement(ElementName = "META")]
      public MetaXML Request { get; set; }
  
      //Property that I dont want to be serialized
      public Subscriber Subscriber { get; set; }
  }
  </code></pre>
  
  <p>the serialization</p>
  
  <pre><code>var xml = new PaymentXML();
  
  string path = HttpContext.Current.Server.MapPath(@_xmlResponseDir + _responsePath);
  
  using (var sw = new StreamWriter(path))
  {
      var ns = new XmlSerializerNamespaces();
      ns.Add("", "");
  
      var serializer = new XmlSerializer(typeof(PaymentXML), new XmlRootAttribute("XML"));
  
      serializer.Serialize(sw, xml, ns);
  }
  </code></pre>
  
  <p>The problem is, it's also serializing the <code>Subscriber</code> property. I only want the <code>RequestXML</code> and <code>MetaXML</code> to be serialized into XML. <strong>How can I exclude the <code>Subscriber</code> property in the serialization process?</strong></p>