How to serialize a nullable int without “xsi:nil” being added to the resulting XML?
XmlSerializer supports the ShouldSerialize{Foo}() pattern, so you can add a method: public bool ShouldSerializeID() {return ID.HasValue;} There is also the {Foo}Specified pattern – not sure if XmlSerializer supports that one.