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;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.