.NET Daily

C#

C# Coding Standards Series – Code Commenting

Posted on .

C# Coding Standards Series – Code Commenting

Introduction

This post is part of a series that covers most of notable C# coding standards that you should follow.

You can download the document with all of the post from here: [download id=”2″ format=”1″]

You can see here the other posts within the series.


Adding comments to your work is without doubt one of the most important factor in team working. More than that, it  also represents the best technique for keeping the code maintainable in time. Have a look at rules below:

1 General Rules

1.1 All comments should be written in the same language, be grammatically correct and contain appropriate punctuation;

1.2 Use // or /// but not /* … */;

1.3 Do not use flower box comments

Ex:

1.4 Use inline comments to explain assumptions, known issues and algorithm insights;

1.5 Do not use inline comments to explain obvious code. Well written code is self-documenting;

1.6 Always apply comment-blocks (///) to public, protected and internal declarations:

Ex:

Please share your opinion about this post by commenting below.

Darius

Darius

Darius Dumitrescu is a creative Senior CMS Consultant with in depth .NET knowledge, focused on Web Development and Architecture Design.

There are no comments.

View Comments (0) ...
Navigation