0

What is the difference between:

Application.NewMail += Application_NewMail;           

private void Application_NewMail()
{
// implementation
}

and

this.Application.NewMail += new Microsoft.Office.Interop.Outlook.ApplicationEvents_11_NewMailEventHandler(ThisAddIn_NewMail);

private void ThisAddIn_NewMail()
{
 // implementation
}

Visual Studio suggests the first one which is automatically added if hitting tap key twice after typing += while the 2nd is always what's shown in MSDN code examples. Are there any functional differences?

Essah
  • 899
  • 2
  • 8
  • 20

1 Answers1

1

first one is a shorter version (introduced in .NET 2.0 i think). both are correct.

also, this is a duplicate (see += new EventHandler(Method) vs += Method)

Community
  • 1
  • 1
Val
  • 1,548
  • 1
  • 20
  • 36