I’m trying to write something that calls a function at runtime without using reflection.
Below is my attempt that doesn’t work D:
public delegate void FunctionPointer(string t);
public void UseFunctionPointer(string t)
{
FunctionPointer pointer = t;
t();
}
I realize I can use a giant switch or if/else to match them, but I want to keep the code clean.
can someone point me to the right direction?
or tell me “it is impossible”
Dictionary of functions by name could be an option: