- 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
Comments in C#
Comments are used for explaining the code. Compilers ignore the comment entries. The multiline comments in C# programs start with /* and terminate with the characters */ as shown below.
Multi-line comments
/* The following is a multi-line comment In C# /*
The /*...*/ is ignored by the compiler and it is put to add comments in the program.
Single line comments
// variable int a = 10;
The following is a sample C# program showing how to add single-line as well as multi-line comments −
Example
using System; namespace HelloWorldApplication { class HelloWorld { static void Main(string[] args) { /* I have started learning C# and this is my first program */ // displaying text Console.WriteLine("Learn C# now!"); Console.ReadKey(); } } }
Output
Learn C# now!
Advertisements