Skip to content

Gendarme.Rules.Design.AvoidVisibleNestedTypesRule(2.10)

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

AvoidVisibleNestedTypesRule

Assembly: Gendarme.Rules.Design
Version: 2.10

Description

This rule checks for nested types which are externally visible. Such types are often confused with namespaces which makes them more difficult to document and find by developers. In most cases it is better to make these types private or to scope them within a namespace instead of a type.

Examples

Bad example:

public class Outer {
    public class Inner {
        // ...
    }
}

Good example (visibility):

public class Outer {
    internal class Inner {
        // ...
    }
}

Good example (unnested):

public class Outer {
    // ...
}
public class Inner {
    // ...
}

Notes

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