
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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
- Related Questions & Answers
- How to write multi-line comments in C#?
- Java single line comments.
- How do we use single line comments in JavaScript?
- How to write single line comment in Java?
- What is the difference between single-line and multi-line comments in JavaScript?
- How to write a single line in text file using Python?
- Java multi-line comments
- How do we use multi-line comments in JavaScript?
- How to put multi-line comments inside a Python dict()?
- Comments in C#
- How to write multi-line comment in Java?
- Comments in C/C++
- How to insert a single line break in HTML?
- How to change collation to utf8_bin in a single line?
- How to Transpose a matrix in Single line in Python?
Advertisements