Lowry Media
C# Naming Conventions
Naming conventions and guidelines are just one way to keep developers within a company on the same page. We have established the following naming conventions to ensure quality code - most of these are Microsoft's .Net naming conventions.

The only exception to this is the last rule. UI server controls are prefixed with 'ux' in order to differentiate the controls on the front-end from those in code-behind. This may seem like Hungarian notation; however, in this case, the prefix doesn't reflect the type of control but rather where the control resides (similar to underscore prefixes for class-level variables). It is just one more way to keep code organized.
Type Standard / Convention
Example
Namespaces Namespaces are defined as CompanyName.ProjectType.
LowryMedia.Web
LowryMedia.Web.Site
LowryMedia.Diagnostics
Assemblies Assemblies are named according to the lowest common namespace amongst the classes; they will always match the naming of the root namespace.
LowryMedia.Web
LowryMedia.Web.Site
LowryMedia.Diagnostics
Classes Classes are named using Pascal case. They should be named according to the function they perform.
DataBoundControl
DocumentService
Interfaces Interface names begin with a capital 'i' and are named similar to classes (Pascal case).
IDataBoundControl
IDocumentService
Collection Classes
Named the same as classes, but with a suffix of 'Collection'.
DataBoundControlCollection
Exception Classes
Named the same as classes, but with a suffix of 'Exception'.
InvalidConversionException
Attribute Classes
Named the same as classes, but with a suffix of 'Attribute'.
CacheableAttribute
Enumerations
Named the same as classes.
DocumentSupportMode
Methods
Methods are named using Pascal case. They should be used to explain what the method does exactly . Underscores should only be used for event handlers.
BindDocument()

uxSubmitButton_Click()
Properties Properies are named using Pascal case. They should not contain underscores.
bool SupportsContentLinks { get; set; }
Method Parameters
Method parameters are named using Camel case. No underscores should be used for these either.
int documentID
bool supportsContentLinks
Class-level Private Variables
Class-level private variables should be named in Camel case and prefixed with an underscore.
int _documentID
bool _supportsContentLinks
UI Elements
Controls on the .aspx page should be named in Pascal case and prefixed with 'ux'. The 'ux' helps differentiate the control from other variables, but by keeping the naming consistent, avoids Hungarian naming problems.
uxDocumentView

uxFirstName