Skip to content

Instantly share code, notes, and snippets.

@jdaigle
Created March 28, 2012 00:35
Show Gist options
  • Save jdaigle/2222148 to your computer and use it in GitHub Desktop.
Save jdaigle/2222148 to your computer and use it in GitHub Desktop.
Coding Conventions

Stolen from: http://aspnetwebstack.codeplex.com/wikipage?title=CodingConventions

= C# coding conventions =

In general, we have strived to use a style which is compatible with the out-of-the-box defaults for Visual Studio. In particular, this means we use Allman bracing style.

Some other rules we follow:

  • Private fields are prefixed with an underscore and camel-cased.
  • Always include curly braces around blocks, even when they would be optional.
  • Using statements go at the top of the file, before the namespace declaration.
  • Use of regions (#region) is not permitted.
  • Using var is okay, if and only if the type is obvious (namely, for “new” statements, cast statements, or anonymous object).
  • All production code must have associated unit tests.
  • All new production code should have at least rudimentary XML doc comments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment