From Appmethod Libraries
Jump to: navigation, search

Object Pascal

procedure Cast(var Dest: TVarData; const Source: TVarData); virtual;


virtual void __fastcall Cast(TVarData &Dest, const TVarData &Source);


Type Visibility Source Unit Parent
System.Variants TCustomVariantType


Converts the data from another Variant type so that it represents this custom type's data format.

Override Cast to enable other types of Variants to be cast to this custom Variant type.

Dest is a TVarData record that returns the Variant's data stored in the format used by this custom Variant type. The Cast method fills out this record from the information in Source.

Source is a TVarData record that contains the data from another Variant type. Check the VType field of Source to identify how it currently stores its data. Then use the other fields to fetch the data and convert it to the format used by this Variant type.

As implemented in TCustomVariantType, Cast checks whether Source is another custom Variant type. If so, it calls its CastTo method, to convert it to this Variant type. If not, it raises a system error indicating an invalid cast.

See Also