C# Tutorials
C# Methods
C# Classes
C# Examples
Comments can be used to describe the C# code, making it more readable. It may also be used to prevent usage when testing another code.
One-line comments start with two forward slashes (//)
Any text between (//) end of line is ignored C# (will not be executed).
This example uses a single-line comment before a line of code:
// This is a comment
"Console"
.
WriteLine
(
"Hello World!"
)
;
This example uses a single-line comment at the end of a line of code:
// This is a comment
"Console"
.
WriteLine
(
"Hello World!"
)
;
Multi-line comments start with / * and end with * /.
Any text between / * and * / will be ignored by C#.
This example uses multi-line comments (comment block) to define code:
Example
/* The code below will print the words Hello World
to the screen, and it is amazing */
Console.WriteLine("Hello World!");