If you want to add a comment that restricts itself to a single line, then use the single-line comments −
// variable int i = 20;
The following is a sample C# program showing how to add single-line comments −
Example
using System;
namespace Demo {
class Program {
static void Main(string[] args) {
// display text
Console.WriteLine("Hello World");
Console.ReadKey();
}
}
}Output
Hello World