A Variantis a union of all built-in data types including an ExtensionObject. Variantscan also contain arrays of any of these built-in types. Variantsare used to store any value or parameter with a data type of BaseDataType or one of its subtypes.

Variantscan be empty. An empty Variantis described as having a null value and should be treated like a null column in a SQL database. A null value in a Variantmay not be the same as a null value for data types that support nulls such as Strings. Some DevelopmentPlatforms may not be able to preserve the distinction between a null for a DataTypeand a null for a Variant, therefore, applications shall not rely on this distinction. This requirement also means that if an Attributesupports the writing of a null value it shall also support writing of an empty Variant and vice versa.

Variantscan contain arrays of Variantsbut they cannot directly contain another Variant.

DiagnosticInfo types only have meaning when returned in a response message with an associated StatusCodeand table of strings. As a result,Variantscannot contain instances ofDiagnosticInfo.

Valuesof Attributesare always returned in instances of DataValues. Therefore, the DataTypeof an Attributecannot be a DataValue. Variantscan contain DataValuewhen used in other contexts such as Method Argumentsor PubSub Messages. The Variantin a DataValuecannot, directly or indirectly, contain another DataValue.

Variableswith a DataTypeof BaseDataTypeare mapped to a Variant, however, the ValueRankand ArrayDimensions Attributesplace restrictions on what is allowed in the Variant. For example, if the ValueRankis Scalarthen the Variantmay only contain scalar values.

ExtensionObjects and Variantsallow unlimited nesting which could result in stack overflow errors even if the message size is less than the maximum allowed. Decoders shall support at least 100 nesting levels. Decoders shall report an error if the number of nesting levels exceeds what it supports.