Get type from string
Adam D. Ruppe via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Oct 28 13:04:48 PDT 2015
On Wednesday, 28 October 2015 at 17:57:16 UTC, DarkRiDDeR wrote:
> Thank you! Is it possible to call a method from a string at run
> time?
Yes, though you have to prepare code to do it. Again, I'd try to
make it work on interfaces on some level.
The free sample chapter of my book
https://www.packtpub.com/application-development/d-cookbook shows
an example near the end of how to write that code. Basically, you
loop over members at compile time and generate wrapper functions
for them, which you then call based on a runtime string.
More information about the Digitalmars-d-learn
mailing list