Answer: event modifier is used to declare any events by using handlers. This modifier is generally used in notification systems where we need to have number of event types.
Any changes and other implementations can be done without disturbing the remaining code of the application.
Example,
public static event EvtHandler MyEvent; // EvtHandler must have been specified outside by using 'delegate' keyword.
static void Main()
{
MyEvent = new EvtHandler(MeetFriends); //Adding notification to the event
MyEvent.Invoke(); //Invoking the event
}
static void MeetFriends()
{
..........;
.........;
}
Asked In: Spotted While Learning |
Alert Moderator