event-handling protected void - .NET Events - What are object sender & EventArgs e?
sender refers to the object that invoked the event that fired the event handler. This is useful if you have many objects using the same event handler.
EventArgs is something of a dummy base class. In and of itself it's more or less useless, but if you derive from it, you can add whatever data you need to pass to your event handlers.
When you implement your own events, use an
EventHandler<T> as their type. This guarantees that you'll have exactly these two parameters for all your events (which is a good thing).
What do sender and eventArgs mean/refer to? How can I make use of them (for the scenario below)?
I'm trying to build a custom control with a delete function, and I want to be able to delete the control that was clicked on a page that contains many of the same custom control.