Total .NET Analyzer Rule Documentation |
|
EventFirstArgumentType Rule
Use the Object type for the first parameter of an event.
Remarks
Microsoft recommends that there should always be two parameters for all events. The first parameter of the event should be of type Object. Microsoft recommends that you always use an Object, even if it is possible to use a more specific type.
Resolution
Modify the event to have the event sender as the first parameter, and make it an object type. 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
Event Usage Guidelines
Total .NET Analyzer Event Argument Count rule
Total .NET Analyzer First Event Argument Type rule