Comments

A comment is essentially a note in a piece of code. It’s used to add human-readable information about the code, and is completely ignored by the C# compiler.

Uses of comments

What we shouldn’t use comments for

Single line comments

We can make a single-line comment in C# by using two forward slashes (//).
Anything after the slashes on that line is part of the comment and will be ignored by the C# compiler.

// This is a single-line comment in C#
Console.WriteLine("Hello, World!"); // This comment is after code

Multi-line comments

We can also do multi-line comments - these are comments that can span multiple lines without needing to start a new comment on each line.

We do this by starting the comment with /* and ending it with */:

/*
This is a multi-line comment in C#
It can span multiple lines
*/
Console.WriteLine( /* we can also do this */ "Hello, World!");