IsNullable Property
Collapse the table of content
Expand the table of content

XmlArrayAttribute.IsNullable Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets or sets a value that indicates whether the XmlSerializer must serialize a member as an empty XML element with the xsi:nil attribute set to true.

Namespace:  System.Xml.Serialization
Assembly:  System.Xml (in System.Xml.dll)

public bool IsNullable { get; set; }

Property Value

Type: System.Boolean
true if the XmlSerializer generates the xsi:nil attribute; otherwise, false.

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 null. For example, if you set a field named MyStringArray to null, the XmlSerializer generates the following XML code.

 <MyStringArray xsi:nil = "true" />

If the IsNullable property is false, no XML element is generated.

NoteNote:

You cannot apply the IsNullable property to a member typed as a value type because a value type cannot contain null.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft