Events and Delegates

  • Delegates can invoke the methods that they reference without making explicit calls to those methods.
  • Events are declares using delegates
  • When an event occurs the control is passed to the event handler method.
  • The event handling method is assigned to the event trough a delegate.
  • Adding an event handing method to an event.

    Syntax:

    <Object.EventName> += new <DelegateName> (<funtionToCall>);

  • Removing an event handling method to an event.

    Syntax:

    <Object.EventName> -= new <DelegateName> (<funtionToCall>);

  • Event call.

    Syntax:

    <EventName> (<parameters>);

  • When an event has no event handler assigned.

    Syntax:

    <EventName> is null;

  • Invoking an event with no event handler will throw an exception

0 comments :

Post a Comment

> Related Posts with Thumbnails
 

Copyright © 2012. GS dot net - All Rights Reserved - Design by BTDesigner - Proudly powered by Blogger