unit Myc.Data.Types.RTTI; interface uses System.SysUtils, System.RTTI, Myc.Data.Types; type TValueHelper = record helper for TDataType.TValue function AsTValue: TValue; end; implementation uses System.Math; { TValueHelper } function TValueHelper.AsTValue: TValue; begin case DataType.Kind of dkVoid: Result := TValue.Empty; dkOrdinal: Result := TValue.From(AsOrdinal.Value); dkFloat: Result := TValue.From(AsFloat.Value); dkText: Result := TValue.From(AsText.Value); dkTimestamp: Result := TValue.From(AsTimestamp.Value); dkEnum: Result := TValue.From(AsEnum.Value); dkMethod: Result := TValue.From(AsMethod.Value); else raise EInvalidOpException.Create('Unsupported data type'); end; end; end.