Skip to content

Gendarme.Rules.Naming.AvoidTypeInterfaceInconsistencyRule(2.10)

Sebastien Pouliot edited this page Jan 22, 2011 · 2 revisions

AvoidTypeInterfaceInconsistencyRule

Assembly: Gendarme.Rules.Naming
Version: 2.10

Description

This rule will fire if an assembly has a namespace which contains an interface IFoo and a type Foo, but the type does not implement the interface. If an interface and a type name differ only by the I prefix (of the interface) then we can logically expect the type to implement this interface.

Examples

Bad example:

public interface IMember {
    string Name {
        get;
    }
}
public class Member {
    public string Name {
        get {
            return String.Empty;
        }
    }
}

Good example:

public interface IMember {
    string Name {
        get;
    }
}
public class Member : IMember {
    public string Name {
        get {
            return String.Empty;
        }
    }
}

Notes

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