[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Variants' (#rtl)

# 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

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

Documentation generated on: May 14 2021