The XML schema specification for structures allows an XML document to explicitly signal that an element's content is missing. Such an element contains the attribute xsi:nil set to true. For more information, see the World Wide Web Consortium (www.w3.org) specification, "XML Schema Part 1: Structures".
If the IsNullable property is set to true, the xsi:nil attribute is generated for class members that have been set to nullNothingnullptra null reference (Nothing in Visual Basic). For example if you set a field named MyStringArray to nullNothingnullptra null reference (Nothing in Visual Basic), the XmlSerializer generates the following XML code.
<MyStringArray xsi:nil = "true" />
If the IsNullable property is false, no XML element is generated for class members that have been set to nullNothingnullptra null reference (Nothing in Visual Basic).
Note: |
|---|
You cannot apply the
IsNullable property to a member typed as a value type because a value type cannot contain nullNothingnullptra null reference (Nothing in Visual Basic). Additionally, you cannot set this property to false for nullable value types. When such types are nullNothingnullptra null reference (Nothing in Visual Basic), they will be serialized by setting xsi:nil to true.
|