CA1724: Type names should not match namespaces

Rule ID CA1724
Category Naming
Fix is breaking or non-breaking Breaking


A type name matches a referenced namespace name that has one or more externally visible types. The name comparison is case-insensitive.

Rule description

User-created type names should not match the names of referenced namespaces that have externally visible types. Violating this rule can reduce the usability of your library.

How to fix violations

Rename the type such that it doesn't match the name of a referenced namespace that has externally visible types.

When to suppress warnings

For new development, no known scenarios occur where you must suppress a warning from this rule. Before you suppress the warning, carefully consider how the users of your library might be confused by the matching name. For shipping libraries, you might have to suppress a warning from this rule.


namespace MyNamespace
    // This class violates the rule
    public class System