Ignore serialize some object fields at runtime (Dynamic Ignore)
<p>I have a webmethod which return an object ASResponse :</p>

<pre><code>    [WebMethod]
    public ASResponse test()
    {
         return new ASResponse ();
     }
</code></pre>

<p>Question :</p>

<p>Is it possible to customize the SOAP response by force the compiler do not serialize some ASResponse class fields ( if some condition are true) and allow them if some condition are false.</p>

<p>Samples :</p>

<pre><code>&lt;soap:Body&gt;
</code></pre>

<p><code>&lt;WrongCaseResponse xmlns="http://tempuri.org"&gt;</code></p>

<pre><code>&lt;WrongCaseResult&gt;

&lt;Length&gt;5&lt;/Length&gt;

&lt;ID&gt;125487&lt;/ID&gt;

&lt;Error&gt;183&lt;/Error&gt;

&lt;/WrongCaseResult&gt;

&lt;/WrongCaseResponse&gt;

&lt;/soap:Body&gt;
</code></pre>

<p>==========================================================================</p>

<pre><code>   &lt;soap:Body&gt;
    &lt;SuccessCaseResponse xmlns="http://tempuri.org"&gt;
  &lt;SuccessCaseResult&gt;
        &lt;Length&gt;5&lt;/Length&gt;
        &lt;ID&gt;125487&lt;/ID&gt;
        &lt;CallHome&gt;5000&lt;/CallHome&gt;
  &lt;/SuccessCaseResult&gt;
&lt;/SuccessCaseResponse &gt;
 &lt;/soap:Body&gt;
</code></pre>
