a quetion about events

Hello,

can someone please tell me what is the difference between the two syntaxes:

this.Enter += new EventHandler(Form1_Enter);

this.Enter += Form1_Enter;

I've noticed that both of them work. So which one should I use does it matter

Thanks,

Ori




Answer this question

a quetion about events

  • Ravuth

    There is no difference (other than the shorter syntax). The compiler knows the type of the event handler needed from the event itself. The second form is new for .NET 2.0.


  • Jamie Thomson

    Thanks. Good to know.

  • a quetion about events