System.Rtti.TValue.Cast
Delphi
function Cast<T>(const EmptyAsAnyType: Boolean = True): TValue; overload;
function Cast(ATypeInfo: PTypeInfo; const EmptyAsAnyType: Boolean = True): TValue; overload;
C++
TValue __fastcall TValue::Cast(const bool EmptyAsAnyType)/* overload */
TValue __fastcall Cast(System::Typinfo::PTypeInfo ATypeInfo, const bool EmptyAsAnyType = true)/* overload */;
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | System.Rtti.pas SystemRtti.h |
System.Rtti | TValue |
Description
Casts the currently stored value to another type.
Call Cast to convert the stored value to another type. Cast requires one parameter, ATypeInfo, which represents the type information of the destination type. Cast returns a new TValue record containing the converted value if the conversion succeeded; otherwise, an exception is raised.
The generic variant of this method does not require any parameters, because is obtains the PTypeInfo information internally.
See Also
Code Examples