Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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 nameFileStreamrather thanCFileStream. - 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
IdentityStoreis appropriate. - 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 namedException, becauseApplicationExceptionis a kind ofException. Use reasonable judgment in applying this rule. For example,Buttonis an appropriate name for a class derived fromControl. Although a button is a kind of control, makingControla 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
See Also
Design Guidelines for Class Library Developers | Base Class Usage Guidelines