Class Naming Guidelines
The following rules outline the guidelines for naming classes:
- Use a noun or noun phrase to name a class.
- Use Pascal case.
- Use abbreviations sparingly.
- Do not use a type prefix, such as
Cfor class, on a class name. For example, use the class name
- Do not use the underscore character (_).
- Occasionally, it is necessary to provide a class name that begins with the letter I, even though the class is not an interface. This is appropriate as long as I is the first letter of an entire word that is a part of the class name. For example, the class name
- Where appropriate, use a compound word to name a derived class. The second part of the derived class's name should be the name of the base class. For example,
ApplicationExceptionis an appropriate name for a class derived from a class named
ApplicationExceptionis a kind of
Exception. Use reasonable judgment in applying this rule. For example,
Buttonis an appropriate name for a class derived from
Control. Although a button is a kind of control, making
Controla part of the class name would lengthen the name unnecessarily.
The following are examples of correctly named classes.
Public Class FileStream Public Class Button Public Class String [C#] public class FileStream public class Button public class String
Design Guidelines for Class Library Developers | Base Class Usage Guidelines