There are two descriptions of the delegate:
first, in a third-party assembly:
public delegate void ClickMenuItem (object sender, EventArgs e)
second, the standard:
public delegate void EventHandler (object sender, EventArgs e);
I’m trying to write a method that will receive a parameter of type EventHandler and will call third-party library, with the parameter ClickMenuItem.
How to convert the ClickMenuItem to EventHandler?
Fortunately, it’s simple. You can just write:
And in reverse:
This will even work in C# 1.0. Note that if you then change the value of the original variable, that change won’t be reflected in the “converted” one. For example: