uses
Classes,TypInfo;
type
TCommandType = (ctEmptyCommand,ctAdd,ctModify);TCommandTypeConvert=classpublicclass function CommandToString(ACommand: TCommandType): string;class function StringToCommand(const AStrCommand: string): TCommandType;end;implementationclass function TCommandTypeConvert.CommandToString(ACommand: TCommandType): string;beginResult := GetEnumName(TypeInfo(TCommandType),Ord(ACommand));end;class function TCommandTypeConvert.StringToCommand(const AStrCommand: string): TCommandType;beginResult := TCommandType(GetEnumValue(TypeInfo(TCommandType), AStrCommand));end;end.