CA1724: Type Names Should Not Match Namespaces

Switch View :
ScriptFree
CA1724: Type Names Should Not Match Namespaces

TypeName

TypeNamesShouldNotMatchNamespaces

CheckId

CA1724

Category

Microsoft.Naming

Breaking Change

Breaking

Cause

A type name matches a .NET Framework namespace names in a case-insensitive comparison.

Rule Description

Type names should not match the names of namespaces that are defined in the .NET Framework class library. Violating this rule can reduce the usability of the library.

How to Fix Violations

Select a type name that does not match the name of a .NET Framework class library namespace.

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.

Community Content

gone_chaos_gone
let's say if i have a class called "security" ,how to resolve?
Warning    19    CA1724 : Microsoft.Naming : The type name 'Security' conflicts in whole or in part with the namespace name 'System.Net.Security' defined in the .NET Framework. Rename the type to eliminate the conflict.    C:\DB\Struct\Structs.cs    10    Db.Data

Change the type as XXXSecurity? It just confuses more.


onedeadgod
Not sure about this.
A better explanation of how to resolve this warning would be appreciated.