Naming Conventions

There is no reason for IFS to invent a completely new standard for this, so we base this on Microsoft's guidelines for .Net code.

If you have MSDN Library installed (you should have!)  you can find this under .NET Framework Reference.

MSDN is also available online at

Naming Guidelines

Generally the use of underscore characters inside names and naming according to the guidelines for Hungarian notation are considered bad practice. Hungarian notation is a defined set of pre and postfixes which are applied to names to reflect the type of the variable. This style of naming was widely used in early Windows programming, but now is obsolete or at least should be considered deprecated. Using Hungarian notation is not allowed if you follow this guide. And remember - a good variable name describes the semantic, not the type.

An exception is UI controls.

Capitalization Styles

Pascal Casing

This convention capitalizes the first character of each word (as in TestCounter).

Camel Casing

This convention capitalizes the first character of each word except the first one. E.g. testCounter.

Class Naming Guidelines

Interface Naming Guidelines

Enum Naming Guidelines

ReadOnly and Const Field Names

Parameter/non const field Names

Method Names

Property Names

Event Names

Example   13: Naming convention for events

// Example of recommended naming
public event ServerInvokeEventHandler Invoking;
public event ServerInvokeEventHandler Invoked;

// Do not write like this
public event ServerInvokeEventHandler BeforeInvoke;
public event ServerInvokeEventHandler AfterInvoke;

Variable Names

Suggested Prefixes for Controls

Use the default names for controls and add a suffix which describes the control. Example, if you pick a Button control and drop it on a form, it will be called button1. If this is a Cancel button, you should typically call it buttonCancel. A grid would typically be called datagridCustomers.

Suggested Prefixes for Menus

Applications frequently use many menu controls, making it useful to have a unique set of naming conventions for these controls. Menu control prefixes should be extended beyond the initial "menuItem" label by adding an additional prefix for each level of nesting, with the final menu caption at the end of the name string. The following table lists some examples.

Menu caption sequence Menu handler name
File Open menuItemFileOpen
File Send Email menuItemFileSendEmail
File Send Fax menuItemFileSendFax
Format Character menuItemFormatCharacter
Help About menuItemHelpAbout

 

Capitalization summary

Identifier Casee Example Note
Class Pascal AppDomain  
Enum type Pascal ErrorLevel  
Enum values Pascal FatalError  
Event Pascal ValueChange  
Exception class Pascall WebException Always ends with the suffix Exception.
Read-only Static field Pascal RedValue  
Interface Pascal IDisposable Always begins with the prefix I
Method Pascal ToString  
Namespace Pascal System.Drawing  
Parameter Camel typeName  
Property Pascal BackColor  
Protected instance field Camel redValue Rarely used. A property is preferable to using a protected instance field.
Public instance field Pascal RedValue Rarely used. A property is preferable to using a public instance field.