Variants.Unassigned

From RAD Studio VCL Reference
Jump to: navigation, search

C++ Information

From Variants.hpp

	System::Variant __fastcall Unassigned(void);


Unit: Variants

Type: function

Description

Returns an "empty" variant.


A variant variable can be "empty", meaning it has not yet been assigned to. The Unassigned function returns an empty variant, which can be assigned to a variant variable to restore the variable to its initial state.

Use the VarIsEmpty function to test whether a variant is empty. When used on an empty variant, the VarType standard function returns varEmpty.

If an empty variant is cast to another type (for example, by assigning to a non-variant variable or calling VarAsType) the following conversions occur:



Destination Conversion result

Numeric type

Zero

String type

Empty string

Boolean

False.



Note:  Unassigned is useful with variants referencing OLE Automation Objects that you want to keep "alive" until another value is assigned to the variant.

There's corresponding functionality under Linux. Should document when time permits.

See Also

Personal tools
Translations
Newest Version