Search code examples
c#.netxmlwcfwcf-binding

How to avoid creation of xml tag for properties which has the value Nothing in WCF?


Suppose i have a service, where i give some input , and i am setting the properties of Name and Age as Nothing Name and Age are nullable types. Now as Name and Age are nothing i do not want a xml tag generated in the output.But below xml tags are generated with nil=true.

 <Name xsi:nil="true"/> 
 <Age xsi:nil="true"/> 

Solution

  • You can control the way WCF serialize objects. Take a look here here