Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
Previous Versions
.NET Framework 3.0
Tools
Development Tools
FxCop
FxCop Warnings
Naming Warnings
 Identifiers should have correct pre...
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
Visual Studio Team System
Identifiers should have correct prefix

TypeName

IdentifiersShouldHaveCorrectPrefix

CheckId

CA1715

Category

Microsoft.Naming

Breaking Change

Breaking

An identifier is not correctly prefixed.

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.

Rename the identifier so that it is correctly prefixed.

Do not exclude a warning from this rule.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Example      David M. Kean - MSFT   |   Edit   |   Show History

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 What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker