Tutorial by Examples

The following terms describe different ways to case identifiers. Pascal Casing The first letter in the identifier and the first letter of each subsequent concatenated word are capitalized. You can use Pascal case for identifiers of three or more characters. For example: BackColor Camel Casing Th...
Interfaces should be named with nouns or noun phrases, or adjectives that describe behaviour. For example IComponent uses a descriptive noun, ICustomAttributeProvider uses a noun phrase and IPersistable uses an adjective. Interface names should be prefixed with the letter I, to indicate that the ty...
There are two common conventions for private fields: camelCase and _camelCaseWithLeadingUnderscore. Camel case public class Rational { private readonly int numerator; private readonly int denominator; public Rational(int numerator, int denominator) { // "this&q...
The general format for namespaces is: <Company>.(<Product>|<Technology>)[.<Feature>][.<Subnamespace>]. Examples include: Fabrikam.Math Litware.Security Prefixing namespace names with a company name prevents namespaces from different companies from having the sa...
Use a singular name for most Enums public enum Volume { Low, Medium, High } Use a plural name for Enum types that are bit fields [Flags] public enum MyColors { Yellow = 1, Green = 2, Red = 4, Blue = 8 } Note: Always add the FlagsAttribute to a bit field E...
Add 'exception' as a suffix Custom exception names should be suffixed with "-Exception". Below are correctly named exceptions: public class MyCustomException : Exception public class FooException : Exception

Page 1 of 1