Category: Fun Code of the Day

Fun Code of the Day #1

unit uEnumConverter; interface type   TEnum = record   public     class function AsString<T>(aEnum: T): string; static;     class function AsInteger<T>(aEnum: T): Integer; static;   end; implementation uses       TypInfo     ; { TEnum } class function TEnum.AsString<T>(aEnum: T): string; begin   Result := GetEnumName(TypeInfo(T), AsInteger(aEnum)); end; class function TEnum.AsInteger<T>(aEnum:…

Read the full article