hi,
i would implement my own AddEventHandler.
my code:
Parameter name: type
i would implement my own AddEventHandler.
my code:
public class Window
{
private Form f;
public Window(Form f)
{
this.f = f;
}
public void AddEventHandler(string name, dynamic handler)
{
f.GetType().GetEvent(name).AddEventHandler(f, Delegate.CreateDelegate(f.GetType(), new Action<string,string>((s, s1) => handler(s, s1)).Method));
}
}
but it throws an exception: The type must be inferred from the delegate.Parameter name: type