Pascal Case with a prefix that identifies it as being part of the UI instead of a purely coded control (ex. a temporary variable). Many developers use "ui" as the prefix followed by a descriptive name such as "UserNameTextBox".
All IT and Non IT Interview Questions, MCQs, Online Quiz Questions, Engineering VIVA Questions
Home » All posts
Wednesday, 4 January 2012
Class-level Private and Protected Variables
Camel Case with a leading underscore. Always indicate 'Protected' or 'Private' in the declaration. The leading underscore is the only controversial thing in this document.
The leading character helps to prevent name collisions in constructors (a parameter and a private variable have the same name).
The leading character helps to prevent name collisions in constructors (a parameter and a private variable have the same name).
Parameters and Procedure-level Variables
Camel Case. Try to avoid abbreviations. Camel Case is the same as Pascal case, but the first letter of the first word is lowercase.
Functions
Pascal Case, no underscores except in the event handlers. Try to avoid abbreviations. Many programmers have a nasty habit of overly abbreviating everything. This should be discouraged.
Exception Classes
Follow class naming conventions, but add Exception to the end of the name. In .Net 2.0, all classes should inherit from the System.Exception base class, and not inherit from the System.Application Exception.
Classes and Structures
Pascal Case, no underscores or leading "C", "cls", or "I". Classes should not have the same name as the name space in which they reside. Any acronyms of three or more letters should be pascal case, not all caps. Try to avoid abbreviations, and try to always use nouns.
Subscribe to:
Comments (Atom)