Writing this in Delphi
uses System.Classes;
...
var
  A: TAlignment;
  Value: TValue;
begin
  Value := 0;
  A := Value.AsType<TAlignment>();
end;
raises EInvalidCast at AsType.
Is there a way to cast to any enumeration type from an integer value with TValue?
This is of course the obvious answer:
A := TAlignment(Value);
but I wish to provide a generic function that works with other types as well.