I need to call the following method:
public bool Push(button RemoteButtons)
RemoteButtons is defined as follows:
enum RemoteButtons { Play, Pause, Stop }
The Push method belongs to the RemoteControl class. Both the RemoteControl class and the RemoteButton enumeration are located inside the assembly that I need to load at runtime. I can load the assembly and create an instance of RemoteControl as follows:
Assembly asm = Assembly.LoadFrom(dllPath);
Type remoteControlType = asm.GetType("RemoteControl");
object remote = Activator.CreateInstance(remoteControlType);
Now, how do I call the Push method, knowing that the only argument is an enum, which I also need to load at runtime?
If I were in C # 4, I would use an object dynamic, but I am in C # 3 / .NET 3.5, so it is not available.
source
share