Naming conventions

Naming conventions are very important to ease application maintenance. Good naming conventions allow developers to quickly know the type of object they are working on. All types and their members shall be named in English so that any team member can understand them. You’ll find here below the conventions that we use in our framework and application templates. Given that C# is case-sensitive, it is important to respect the case of the following naming conventions to avoid any confusion.

Classes

  • Convention : Pascal case
  • Example : MyClass

Methods

  • Convention : Pascal case
  • Example : MyMethod

Properties

  • Convention : Pascal case
  • Example : MyProperty

Fields

  • Convention : Camel case
  • Prefix : _
  • Example : _myField

Parameters

  • Convention : Camel case
  • Example : myParameter

Constants

  • Convention : Uppercase
  • Word separator : _
  • Example : MY_CONSTANT

Language Resources

  • Convention : Pascal case
  • Resource types :
    • Inline text
      • Common use : TextBlock, Label
      • Prefix : Label_
      • Example : Label_MyText
    • Header :
      • Common use : DataGrid header, TabItem header
      • Prefix : Header_
      • Example : Header_MyTextHeader
    • Button :
      • Common use : Button text
      • Prefix : Button_
      • Example : Button_MyButtonLabel
    • Menu :
      • Common use : Menu labels
      • Prefix : Menu_
      • Example : Menu_MyMenuLabel
    • Error :
      • Common use : Error messages that are displayed in a message box or in a view
      • Prefix : Error_
      • Example : Error_MyErrorMessage
    • Enumeration value :
      • Common use : ComboBox
      • Prefix : Enum_
      • Parameter separator : _
      • Parameters : Enumeration type name, enumeration value name
      • Example : Enum_MyEnumerationType_MyEnumerationValue1
Advertisements