CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2001
    Location
    Silicon Valley
    Posts
    113

    Question Adding an event handler (a newbie question, perhaps)

    Is there a difference between the following 2 lines of code?
    Code:
    m_ctrPanel.Leave += this.OnLeave;
    and
    Code:
    m_ctrPanel.Leave += new System.EventHandler(this.OnLeave);
    Obviously, they serve the same purpose – add event handler.

    Any insight or reference is really appreciated!

    Cheers,
    - Nick

  2. #2
    Join Date
    Jun 2008
    Posts
    2,477

    Re: Adding an event handler (a newbie question, perhaps)

    Nope, no difference. The compiler can figure it out as long as the delegate type is compatible, it's just syntactic sugar.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured