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

# VarTypeIsValidElementType

Check if a variant type can be used in an array

## Declaration

Source position: variants.pp line 142

`function VarTypeIsValidElementType(`
`const aVarType: tvartype`
`):Boolean;`

## Arguments

`aVarType` |  | Type to test

## Function result

True if the variant type aVarType can be used in an array

## Description

VarTypeIsValidElementType checks if the variant type aVarType can be used as the type of a variant array, similar to VarTypeIsValidArrayType. It returns True if it is usable, False otherwise. Currently, the following types are valid: SmallInt, Integer, Single, Double, Date, Currency, OleStr, Dispatch, Error, Boolean, Variant, Unknown (interface IUnknown), ShortInt, Byte, Word, LongWord int64. In addition, if the variant type is an known custom variant type, True is also returned.

Reference and array indicators are stripped before the test.

## See also

VarIsArray |  | Check whether a variant is an array
VarTypeIsValidArrayType |  | Check if a variant type can be used in an array

Documentation generated on: May 14 2021