System.Rtti.TValue.Cast

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function Cast<T>: TValue; overload;
function Cast(ATypeInfo: PTypeInfo): TValue; overload;

C++

TValue __fastcall TValue::Cast(void)
TValue __fastcall Cast(System::Typinfo::PTypeInfo ATypeInfo)/* 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