Monday, March 15, 2010

Code: C# Best Practices

I found a nice C# coding best practices doc from DotNetSpider today: http://www.dotnetspider.com/tutorials/BestPractices.aspx

Great to use as a starting point for your own standards.

A couple things I’d change:

1.  There should only be 1 exit point in a method.  The word return should only appear once, and it should be the last line in the method.

2.  The Public regions should appear before Private regions in a class.  When navigating to a business method from a UI class it seems more natural to jump into the top of a file and work your way down.