I see the following arguments repeated a lot in boilerplate code and yet I don’t seem to have made use of them yet?
(object sender, EventArgs e)
e.g if I double-click on a new button then the event’s method has these arguments and yet when I add code to the method I don’t use the arguments.
What are they and when do I use them?
The sender is the originator of the event – so you might have several buttons using the same click handler, and you want to disable whichever button was clicked, for example. It’s not terribly useful if you only use an event handler to subscribe to an event for a single source, of course.
EventArgsitself is pretty pointless, as it has no information – but it’s used as the base class for other classes which do have information (such as keyboard and mouse information). The good thing about having it present at all is that if you don’t need that extra information, you can create a single event handler which can be used to subscribe to any event which follows the pattern. For example: