I’m able to assign to delegate object d a method M with less specific parameter type, but if I want to assign to d an anonymous method with same signature as method M, then I get an error. Any idea why that is?
class derivedEventArgs : EventArgs { }
delegate void newDelegate(object o, derivedEventArgs e);
static void Main(string[] args)
{
newDelegate d = M; // ok
d = (object o, EventArgs e) => { }; // error
}
public static void M(object o, EventArgs e) { }
thanx