Single Line Comment#
A single line comment starts with // and continues until the end of the line.
// Everything on this line is commented.
Console.WriteLine("Hello, World!");You can also write it inline, to the right of your code:
Console.WriteLine("Hello, World!"); // Everything to the right is commented.Block Comment#
A block comment starts with /* and ends with */. Everything in between is ignored.
/*
This is a block comment
It can span
multiple lines
*/
Console.WriteLine("Hello, World!");You can also use block comments in a single line or inline:
/* Block comment in a single line */
Console.WriteLine("Hello, World!"); /* Block comment inline */Always close a block comment. If you don’t, everything after it will be treated as part of the comment.