For anyone who currently writes C#, or is looking to start I highly recommend you pick up a copy of… 

The Elements of C# Style by Kenneth Baldwin, Andrew Gray, Trevor Misfeldt Read more about this title…

This book offers great suggestions for programming style in the C# language. It covers things like:

The book contains a series of rules to abide by, most of the rules are quite flexible. The main premise of the book is to maintain consistency but offers variations that a C# developer can follow.

Here are a few example’s taken from the book:

  1. Use Camel Case for Variable and Method Parameter Names Use lowercase for the first word and capitalize each subsequent word that appears in a variable name to provide a visual cue for separating the individual words within each name.
public class Customer 
  {
    public string firstName;
    public string lastName;
    public string ToString()
    {
      return lastName + ", " + firstName;
    }
  }
  1. Use an Organization Name for the Root Namespace, and Narrow by Project, Product or Group
namespace Company.Group.Project
  {
  }

This book is an extremely quick read, but well worth the price. It comes in handy as an excellent reference manual!

comments powered by Disqus