
- 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
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!
- Related Articles
- Comments in Python
- Comments in Perl
- Explain Comments in JavaScript
- Comments in C/C++
- /** and /* in Java comments
- Executable Comments in Java
- Comments in Java\n
- Comments in Dart Programming
- Comments in Rust Programming
- Comments in Lua Programming
- HTML Comments
- Java comments.
- CSS Comments
- What are Comments in JavaScript?
- Comments in C++ Programming Language

Advertisements