
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
What are the comments in C#?
Comments are used for explaining code. Compilers ignore the comment entries. The multiline comments in C# programs start with /* and terminates with the characters */ as shown below.
Multi-line comments
/* The following is a mult-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 Demo { class Program { static void Main(string[] args) { /* I have started learning C# and is my first program */ // displaying text Console.WriteLine("Hello World"); Console.ReadKey(); } } }
Output
Hello World
- Related Articles
- What are Comments in JavaScript?
- What are JSP comments?
- What are comments in Java language?
- What are the various types of comments in JavaScript?
- Comments in C#
- Comments in C/C++
- What are the several ways to add comments in MySQL query?
- What type of comments does C++ support?
- Comments in C++ Programming Language
- What is the difference between /* */ and /** */ comments in Java?
- What is the difference between comments /*...*/ and /**...*/ in JavaScript?
- Remove comments in a string using C++
- How to write multi-line comments in C#?
- How to write single-line comments in C#?
- Comments in Python

Advertisements