find and solve || findandsolve.com
Please wait.....

How to Comments in C#

To explain C# code and make it even more readable, comments can be used . It is also used to prevent execution when testing alternative code.

Single- line Comments

  •  It starts with two forward slashes(//).
  •  Any text between // and end of line is not executed by C#.
Example
// This is a single line comment
Console.WriteLine(“Hello World!");

C# Multi-line Comments

  •  It starts with /* and ends with */.
  • Text between /* and */ will be ignored by C#.
Example
/*The code which is underneath , will print the text Hello World
     at the screen, and this is really amazing and outstanding */
Console.WriteLine(“Hello World!”);