System.Rtti.TValue.TryCast
Delphi
function TryCast(ATypeInfo: PTypeInfo; out AResult: TValue; const EmptyAsAnyType: Boolean = True): Boolean;
C++
bool __fastcall TryCast(System::Typinfo::PTypeInfo ATypeInfo, /* out */ TValue &AResult, const bool EmptyAsAnyType = true);
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | System.Rtti.pas System.Rtti.hpp |
System.Rtti | TValue |
Description
Tries to cast the currently stored value to another type.
Call TryCast to try to convert the stored value to another type. TryCast requires two parameters, ATypeInfo which represents the type information of the destination type, and an out value, AResult, in which the TValue record containing the converted value will be placed. TryCast returns true if the conversion succeeded, and false otherwise.