implementation Uses TypInfo; procedure TForm3.FormCreate(Sender: TObject); //定义枚举类型 type TDayOfWeek=(Monday,Tuesday,Wednesday,Thursday,FriDay,Saturday,Sunday); var s: string; aWeek:TDayOfWeek; begin ShowMessage('枚举字符串:' + GetEnumName(TypeInfo(TDayOfWeek), 0) ); ShowMessage('枚举字符串:' + GetEnumName(TypeInfo(TDayOfWeek),Ord(Monday))); aWeek:=Monday; ShowMessage('枚举字符串:' + GetEnumName(TypeInfo(TDayOfWeek),Ord(aWeek))); end;
GetEnumName(TypeInfo( System.TTypeKind), ord( pMethod.ReturnType.TypeKind));