uses
.., System.Rtti, System.TypeInfo;
type
TDeveopistType = (dtTest1, dtTest2, dtTest3, dtTest4, dtTest5);
var
I: Integer;
FieldType: TRttiType;
OrdinaryType: TRttiOrdinalType;
Name: string;
begin
FieldType := TRttiContext.Create.GetType(TypeInfo(TDeveopistType));
OrdinaryType := FieldType.AsOrdinal;
for I := OrdinaryType.MinValue to OrdinaryType.MaxValue do begin
Name := GetEnumName(FieldType.Handle, I);
ShowMessage(Name);
end;
end;
반응형