Sitemap

Commenting Your Code

1 min readApr 6, 2021

--

Correctly commenting out your code with meaningful information is one of the most fundamental habits a new programmer should have.

Visual Studio doesn’t process lines starting with two backslashes.

If you want multi-line comments, you’ll need to use a backslash and an asterisk as opening and closing characters around your comment:
/* I can write as many comment lines
…………
as I want here */

Get Farid Louali’s stories in your inbox

Join Medium for free to get updates from this writer.

Tip: You can comment and uncomment blocks of code by highlighting them and using:

  • command+? on mac
  • Ctrl+K+C on Windows

Visual Studio provides an auto-generated commenting feature; When you type three backslashes preceding any variables, methods, or class, a summary comment block appears.

/// <summary>
/// you can type any description here
/// <summary>

When using this way of commenting, all you need to do is hover over the code you commented on anywhere, and Visual Studio will pop your summary.

Press enter or click to view image in full size
Auto Generated Commenting feature

I hope you find these tips helpful in your daily workflow.

--

--

Farid Louali
Farid Louali

Written by Farid Louali

I studied architecture, and I’ve always had a keen interest in 3D modeling, 3D rendering, animation, and game design.