Jump to content
Sign in to follow this  
Lars Fosdal

RTTI, determine record helper type for a base type

Recommended Posts

Consider

type
  TSomeType = (One, Two Three);
  TSomeTypeHelper = record helper for TSomeType
    class function Values: TArray<string>;
  end;

 

Can I use RTTI to find the record helper type for TSomeType and the Values function?

 

Reason: I'd like to call Values  - which would be a naming convention (since record helpers can't be inherited or generic) - for any type that has a record helper with a class function named Values.

Share this post


Link to post

No, unless you reference the helper type itself somewhere which you typically don't and if you do you can just register the function somewhere so you don't need to use RTTI.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×