Projects from year 1998 until NOW ... - Developed by AHYEEK

Tuesday, June 29, 2010

Event Vs Delegate

An event is a message sent by an object to signal the occurrence of an action. The object that raises the event is called the event sender. The object that captures the event and responds to it is called the event receiver. In event communication, the event sender class does not know which object or method will receive (handle) the events it raises. What is needed is an intermediary (or pointer-like mechanism) between the source and the receiver. The .NET Framework defines a special type (Delegate) that provides the functionality of a function pointer.

A delegate is a class that can hold a reference to a method.
A delegate class has a signature, and it can hold references only to methods that match its signature. Thus equivalent to a type-safe function pointer or a callback.

Sample Code Download :

No comments: