Visual Studio Team System
Identifiers should have correct prefix

TypeName

IdentifiersShouldHaveCorrectPrefix

CheckId

CA1715

Category

Microsoft.Naming

Breaking Change

Breaking

Cause

An identifier is not correctly prefixed.

Rule Description

By convention, the names of certain programming elements start with a specific prefix.

Interface names should begin with a capital 'I' followed by another capital letter. This rule reports violations for interface names such as 'MyInterface' and 'IsolatedInterface'.

Naming conventions provide a common look for libraries that target the common language runtime. This reduces the learning curve required for new software libraries, and increases customer confidence that the library was developed by someone with expertise in developing managed code.

How to Fix Violations

Rename the identifier so that it is correctly prefixed.

When to Exclude Warnings

Do not exclude a warning from this rule.

Related Rules

Identifiers should not have incorrect prefix

Tags :


Community Content

David M. Kean - MSFT
Example

This rule only fires on publicly visible interfaces. 

The following example demonstrates a violation of this rule:

using System;
 
namespace NamingLibrary
{
    public interface MyInterface // Violates IdentifiersShouldHaveCorrectPrefix
    {
    }
 
    public interface IsolatedInterface // Violates IdentifiersShouldHaveCorrectPrefix
    {
    }
 
    public interface IIsolatedInterface // Does not violate IdentifiersShouldHaveCorrectPrefix
    {
    }
 
    internal interface AnotherInterface // Does not violate IdentifiersShouldHaveCorrectPrefix
    {
    }
}
Tags :

Page view tracker