Total .NET Analyzer Rule Documentation |
|
Use two parameters for events.
Remarks
Microsoft recommends that there should always be two parameters for all events. These parameters should specify the event sender and event arguments, and should be named 'sender' and 'e'.
Resolution
When defining events, you should specify two parameters named 'sender' and 'e'. The 'sender' parameter should be an object type, and it should represent the object that raised the event. The 'e' parameter should be an appropriate and specific event class, and it should represents the state associated with the event.
For example, the following event handlers follow Microsoft's guidelines:
' VB
Public Delegate Sub MouseEventHandler(sender As Object, e As EventArgs)
// C#
public delegate void MouseEventHandler(object sender, EventArgs e);
See Also
Events and Delegates
Event Naming Guidelines