How to Comment Code in C# 9

In this blog post, we will learn how to comment single-line or multiple lines of code in a .NET C# 9 program code and make our code more user friendly.

Single-line Commenting

The first and most common commenting option in C# is a single line commenting which is done as shown below.

int myvar = 10;  // Single line comment 

Multi-lines Commenting

Sometimes you might need to comment on multiple lines of code either to explain or document sections of your code or just to temporarily mask a code blow. The example below shows how to comment multi-lines.


Multilines commenting


Categorized as C#, C# 9

Leave a comment

Your email address will not be published.