My question is just if there is a way to get the string value from a construct like the above?
In another post here on the support forum, I saw EnumName being mentioned, but I assume there might a unit that needs to be included, but cannot find if there is one. Thus unable to use it.
Hi Russel, yes I could use a const array, but as you mentioned it will duplicate the code.
Usually I add helpers like this:
TEnumTestHelper = record helper for TEnumTest
function ToString: string;
end;
{ TEnumTestHelper }
function TEnumTestHelper.ToString: string;
begin
case Self of
TEnumTest.oneA: result := '1A';
TEnumTest.twoB: result := '2B';
TEnumTest.threeC: result := '3C';
end;
end;
But in this case this also duplicates code. So I was hoping to find another solution since I already need to have this in my code:
But, it's not a showstopper if there is no easy way to do what I want. I just wanted to use this technique in an Integration software that have running that does not use Aurelius.