Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
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
Iprefix on the interface name. - Do not use the underscore character (_).
The following are examples of correctly named interfaces.
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.
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