- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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
Advertisements