Skip to content

Gendarme.Rules.Correctness.DeclareEventsExplicitlyRule(git)

Sebastien Pouliot edited this page Mar 2, 2011 · 1 revision

DeclareEventsExplicitlyRule

Assembly: Gendarme.Rules.Correctness
Version: git

Description

This rule detect is an event handler was declared without the event keyword, making the declaration a simple field in its type. Such occurances are likely a typo and should be fixed.

Examples

Bad example:

public class EventLess {
    public static EventHandler<EventArgs> MyEvent;
}

Good example:

public class Event {
    public static event EventHandler<EventArgs> MyEvent;
}

Source code

You can browse the latest source code of this rule on github.com

Clone this wiki locally