All rules
CA1724Naming Enabled by default: No

Type names should not match namespaces

Type names should not match namespaces

Microsoft docs

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.

Cause

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

How to fix violations

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

Example

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

When to suppress

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.

Group results
0 yes 0 no
ConsensusNone (disabled)
Severity preference (yes voters)
Suggestion0
Warning0
Error0