C# Comments

There are two different types of comments in C#.

The first of which is a single line comment that as its name states, can only be used on a single line at a time.

//this is a single line comment

If you want to add comments that may take more than one line you have the option of using multiple single line comments.

//you can use
//multiple single line
//comments to make
//a block 

You also have the option of using a block style comment.

/*this
* is
* a
* multi-line comment */ 

It is considered good practice to use multiple comments throughout your code. It not only helps other developers understand what you were trying to accomplish, it’s a good reference for you to look back on after putting down a project for a couple of months.

*note* Comments are not taken into consideration by the compiler, multiple comments will not bulk up your end executable.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s