tags:

views:

44

answers:

2

I'm working on a Silverlight project and I'm trying to understand the differences between the following:

this.Startup += new StartupEventHandler(this.Application_Startup);
this.Startup += this.Application_Startup;
+4  A: 

These are identical. The difference is just syntactic sugar: the compiler is automatically wrapping the function in a delegate in the second case.

This has been around since .NET 2.0; prior to that only the first case would have compiled.

Daniel Renshaw
+4  A: 

These are the same, the second line is a little syntax sugar - the compiler will wrap Application_Startup method into the delegate StartupEventHandler automatically.

Grzenio