[DUG] Why use a set when a string will work OK (and less code)?
Paul Heinz
paul at accredo.co.nz
Thu May 10 11:17:51 NZST 2007
Sean Cross wrote:
> TMyStatus = (Active, Pending, Ended, Paused, Deleted,
> Suspended); StatusMeanings = array[TMyStatus] of string =
> ('Active', 'Pending', 'Ended', 'Paused', 'Deleted', 'Suspended'); ...
> ShowMessage(StatusMeanings[Status]);
Also, Delphi can do this for you using RTTI - this is how enum
properties work inside .dfms i.e. translating to/from string constants.
Uses
TypInfo;
ShowMessage(GetEnumName(TypeInfo(TMyStatus), Integer(Status));
TTFN,
Paul.
More information about the Delphi
mailing list