Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
How to write single-line comments in C#?
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
Advertisements
