Total .NET Analyzer Rule Documentation  

EventReturn Rule

Do not return values with event handlers.

Remarks

Microsoft recommends that event handlers return void. Event handlers are designed to execute events, not to return values. Since events can be raised from multiple code locations and code branches, the return value will always be from the last event call, which eliminates any benefits from having a return value.

Resolution

Modify the event handler to return void. In Visual Basic, this means using a Sub (rather than a Function):

' VB
Public Delegate Sub MouseEventHandler(sender As Object, e As EventArgs)

In C#, use a return type of void:

// C#
public delegate void MouseEventHandler(object sender, EventArgs e);

See Also

Event Usage Guidelines

Events and Delegates