Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
Previous Versions
.NET Framework 1.1
.NET Framework
Reference
Naming Guidelines
 Interface Naming Guidelines
.NET Framework General Reference
Interface Naming Guidelines

The following rules outline the naming guidelines for interfaces:

  • Name interfaces with nouns or noun phrases, or adjectives that describe behavior. For example, the interface name IComponent uses a descriptive noun. The interface name ICustomAttributeProvider uses a noun phrase. The name IPersistable uses an adjective.
  • Use Pascal case.
  • Use abbreviations sparingly.
  • Prefix interface names with the letter I, to indicate that the type is an interface.
  • Use similar names when you define a class/interface pair where the class is a standard implementation of the interface. The names should differ only by the letter I prefix on the interface name.
  • Do not use the underscore character (_).

The following are examples of correctly named interfaces.

[Visual Basic]
Public Interface IServiceProvider
Public Interface IFormatable
[C#]
public interface IServiceProvider
public interface IFormatable

The following code example illustrates how to define the interface IComponent and its standard implementation, the class Component.

[Visual Basic]
Public Interface IComponent
   ' Implementation code goes here.
End Interface

Public Class Component
   Implements IComponent
   ' Implementation code goes here.
End Class

[C#]
public interface IComponent 
{
   // Implementation code goes here.
}
public class Component: IComponent 
{
   // Implementation code goes here.
}

See Also

Design Guidelines for Class Library Developers | Base Class Usage Guidelines

© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker