I did not find .NET Events – What are object sender & EventArgs e? post much helpful.
It primarily tells that how the parameters (object sender, EventArgs e) are used in case of onClick scenario, which turns out to be the obvious use.
My question is :
Neglecting the onClick function
i.e In case of Page_Load, Init and other page events
What is the use of these (object sender, EventArgs e) parameters ?
Examples would be more helpful 🙂
Using standard(similar) signature such as
(sender, eventargs)is beneficial becauseNow, once you accept/agree some standards, you need to stick them (even though in certain cases, it may not make sense provided that there is no huge cost associated with). .NET Fx developers has decided on this standard event template and that what’s you will see everywhere.
Let’s take an example of
Page_Load– this event is actually declared at Control level. So its possible that some code may choose to handle multiple control’s load event using the same event handler and usesenderargument to apply specific things.