7
Reply

Delegates and Events

S

S

Jun 21 2012 8:30 AM
1.3k
Hi

Why do most .NET Framework events take the following form:-

Page_Load(Object sender, EventArgs e)

Looking at the Event example in the MSDN documentation it is as follows:-

// Declare the Delegate
public delegate void SampleEventHandler(Object sender, EventArgs e)

// Declare the Event
// public event SampleEventHandler SampleEvent;

//Raise the Event
SampleEvent(this, e);

So given Page_Load is an Event it doesnt fit any of the above syntax. The only one that it is similar to is the delegate but of course this is a Delegate.

I just need a bit of clarification please. I know the Page_Load is the Event Handler Method so is this used differently to the above as the Method has its own Object sender, EventArgs e parameters?

Regards

Steven



Answers (7)