Skip to content

VarAsType

Attempt to cast a variant to another type

Declaration

Source position: variants.pp line 69

  function VarAsType(const V: Variant; aVarType: tvartype) : Variant;

Description

VarAsType attempts to cast the variant V to a new variant of type aVarType and returns the new variant.

Errors

If the requested type cast is not supported or possible, an EVariantTypeCastError exception may be raised.

See also

Name Description
EVariantTypeCastError Error raised when an invalid typecast is performed
VarAsType Attempt to cast a variant to another type
VarIsType Check if a variant is of certain type