.NET Programming Standards and Naming Conventions
Common .NET Naming Conventions
These are the industry-accepted standard naming conventions for J#, C# and VB.NET programs. For additional information, please see the MSDN help documentation and FX Cop. While individual naming conventions at organizations may vary (Microsoft only suggests conventions for public and protected items), the list below is quickly becoming the de-facto standard in the industry. Please note the absence of Hungarian Notation except in visual controls. These naming standards should find their way into all of your .NET development, including ASP.NET Web applications and .NET Windows Forms applications.
Note that while this document predates the online and printed standards documentation from Microsoft, everything below which indicates it is based on .NET library standards is consistent with that documentation. In areas where Microsoft has not provided guidance (Microsoft generally doesn't care what you do in private/non-exposed code. In fact, they aren't even consistant in their internal code in the .NET framework), de facto standards have emerged, and I have captured them here.
The "ux" naming convention for controls is something I have added and found to be helpful. It is not based on any official standards, but instead based upon a multitude of projects by my teams and others, as well as on-line discussions on the topic. While I strongly recommend that you follow Microsoft guidelines when present, I encourage you to try out the items marked as extensions below and see how they work for you before committing to them.
Type | Standard / Convention | Example |
---|
Namespaces |
| AppliedIS.TimeCard.BusinessRules
|
Assemblies |
|
|
Classes and Structs |
|
|
Collection Classes |
| WidgetCollection |
Delegate Classes |
| WidgetCallbackDelegate |
Exception Classes |
| InvalidTransactionException |
Attribute Classes |
| WebServiceAttribute |
Interfaces |
| IWidget |
Enumerations |
|
|
Functions and Subs |
|
|
Properties and Public * Member Variables |
|
|
Parameters |
|
|
Procedure-Level Variables |
|
|
Class-Level Private and Protected Variables |
|
|
Controls on Forms |
|
|
Constants |
|
|