Enum to integer



Enum to Integer
Smart pascal source code
type TEnumOne = (eOne = 1, eTwo, eThree); type TEnumAlpha = (eAlpha = Ord('A'), eBeta, eGamma); type TConvert = class class function Get(i: Integer): String; begin Result := Chr(i); end; property Prop[i: Integer]: String read Get; end; WriteLn(Ord(eOne)); WriteLn(eTwo); WriteLn(IntToStr(eThree)); WriteLn(Chr(Ord(eAlpha))); WriteLn(Chr(eBeta)); WriteLn(TConvert.Prop[eGamma]); WriteLn(eOne.Value); WriteLn(TEnumOne.eTwo.Value.ToString); var three: TEnumOne := eThree; WriteLn(three.Value); { <<< CONSOLE OUTPUTS >>> 1 2 3 A B C 1 2 3 }