I'm serializing a class like this
public MyClass
{
public int? a { get; set; }
public int? b { get; set; }
public int? c { get; set; }
}
<MyClass ...>
<a>3</a>
<b xsi:nil="true" />
<c xsi:nil="true" />
</MyClass>
<MyClass ...>
<a>3</a>
</MyClass>
I suppose you could create an XmlWriter that filters out all elements with an xsi:nil attribute, and passes all other calls to the underlying true writer.