What I effectively want to do is something like this (I realise this is not valid code):
// Attach the event.
try
{
EventInfo e = mappings[name];
(e.
You can use Delegate.CreateDelegate to accomplish your goal like this:
public void RegisterHandler(string name)
{
EventInfo e = mappings[name];
EventHandler handler = (s, raw) =>
{
func.Call(this, raw.GetParameters());
};
e.AddEventHandler(this, Delegate.CreateDelegate(e.EventHandlerType, null, handler.Method));
}