This documentation is archived and is not being maintained.

Component Naming Recommendations

Visual Studio .NET 2003

The names you select for your classes — and for their properties, methods, and events — are one of the most important factors in how easy it is to use your component. When naming these elements and their formal parameters, you can help the user of your component by following a few simple rules.

  • Use complete words whenever possible — for example, SpellCheck. Abbreviations can take many forms, and hence can be confusing. If you plan to localize your component for other cultures, be aware that abbreviations can be hard for a non-native speaker to understand. If whole words are too long, use complete first syllables or carefully chosen abbreviations.
  • Use mixed case for your class, method, and property names, capitalizing each word or syllable — for example, ShortcutMenus, or AsyncReadComplete.
  • Use the same word or phrase your users would use to describe a concept. For example, you might have a SavingsAccount component that represented a savings account.
  • Append "Collection" onto the correct name of the object contained by your collection — for example WorksheetCollection, FormCollection, or WidgetCollection.
  • Use either the verb/object or object/verb order consistently for your method names. For example, placing the verb first results in names like InsertWidget and InsertSprocket, whereas placing the object first yields names like WidgetInsert and SprocketInsert.
  • Do not repeat the name of the class in the method. For example, if you have a class named Book, do not have a method called Book.CloseBook. Instead, name your method Book.Close.

See Also

Coding Techniques