Skip to content

Gendarme.Rules.Design.Generic.UseGenericEventHandlerRule(2.10)

Sebastien Pouliot edited this page Feb 18, 2011 · 4 revisions

UseGenericEventHandlerRule

Assembly: Gendarme.Rules.Design.Generic
Version: 2.10

Description

This rule fires if an assembly targets .NET 2.0 or later and defines a delegate which can be replaced by [[System.EventHandler<TEventArgs>|http://msdn.microsoft.com/library/System.EventHandler.aspx]].

Examples

Bad example:

public delegate void AuthenticityHandler (object sender, AuthenticityEventArgs e);
public event AuthenticityHandler CheckingAuthenticity;
public event AuthenticityHandler CheckedAuthenticity;

Good example:

public event EventHandler<AuthenticityEventArgs> CheckingAuthenticity;
public event EventHandler<AuthenticityEventArgs> CheckedAuthenticity;

Notes

  • This rule is available since Gendarme 2.2
Clone this wiki locally