Essential C# Events  Suggest an edit

Standard Event Declaration

Event declaration:

public event EventHandler<EventArgsT> EventName;

Event handler declaration:

public void HandlerName(object sender, EventArgsT args) { /* Handler logic */ }

Subscribing to the event:

Dynamically:

EventName += HandlerName;

Through the Designer:

  1. Click the Events button on the control’s properties window (Lightening bolt)
  2. Double-click the Event name:
  1. Visual Studio will generate the event code:
private void Form1_Load(object sender, EventArgs e)
{

}

Invoking the method:

EventName(SenderObject, EventArguments);

Table Of Contents
22 Enum
25 GUID
89 Events
107 Stream
108 Timers
  ↑ ↓ to navigate     ↵ to select     Esc to close