10.4. VariantΒΆ

Converting data to a variant allows us to treat encapsulated data in a generic manner and store different types of data in the same storage location. The National Instruments documentation explains that a variant is a data type that stores both a value and metadata specifying how the data should be interpreted. Variants are not variables without a data type but typed variables that can change their data type as needed. There are functions that will convert data to a variant and return it to its original data type. To retrieve data from a variant, it is necessary to know its data type. Simple values stored as variants only need a constant of that data type to retrieve the data, but clusters need a Type Def of the cluster to retrieve the data.