C.2. Naming C# events

Delegate names which are to be used for declaring events (event handlers) should end with EventHandler to differentiate them from other delegates. If your event handler takes in the standard reference to sender/event source and event argument object parameters, use the variable names sender and e. For example:

delegate void MouseEventHandler(object sender, MouseEvent e);

Event argument class names should end with EventArgs. For example:

public class MyEventArgs: EventArgs{...}

Get From Java to C#: A Developer's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.