Wednesday, July 1, 2009

C# Class Template - Coding with Style

Quality in programming is usually measured in terms of the end, not the means. That is, as long as an application, component, or services meets its functional requirements, the code is deemed "good enough". But what about best practices and coding style? Why can't code meet its expectations cosmetically, as well as functionally?

The following template provides a simple yet effective structural layout for a C# class. It contains place holders for most of the common elements of a C# class and should greatly improve the readability and maintainability of your code. And last, but not least, there will be perception of quality and craftsmanship to your code that goes beyond bits and bytes, inspiring confidence in both the developer and the developed.


Screenshot of C# Class Template

Following is an enumeration of the code sections contained in the template:

  • Class Variables
  • Constants
  • Constructors
  • Delegates
  • Destructors
  • Enumerations
  • Events
  • Fields
  • Indexers
  • Methods
  • Operators
  • Property Accessors
  • Private Structures
  • Private Classes

Use the link below to download the C# class template. If you have a comment or suggestion about code templates that you would like to share, please reply to this post.

Download: CSharpCodeTemplate.txt

Happy coding!

[END_OF_LINE]

No response to “C# Class Template - Coding with Style”

Leave a Reply