This Angular tutorial helps you get started with Angular quickly and effectively through many practical examples.

C# - Comment


In this tutorial, we'll learn how to use comments with single line, multi-line. The comment in the program to skip certain statements from execution in C#.

C# Comments

The purpose of making the source code easier for humans to understand used comment. Comments are brief descriptions of the logic and workings of the written code in C#. Comments are descriptions in the C# code that help users better understand the intent and functionality of the C# Code.

There are two types of comments in C#: single-line comments and multi-line comments.

  1. Single-line comments
  2. Multi-line comments

1. Single-line comments

Single-line comments start with two forward slashes // and continue until the end of the line.

Example

 // This is a single-line comment
 int x = 56; // This is also a single-line comment

2. Multi-line comments

Multi-line comments start with /* and end with */. Everything between these two characters is treated as a comment.

Example

 /*
 This is a multi-line comment.
 It can span multiple lines.
 */
int y = 88;

Prev Next

Top Articles

  1. Why use C#
  2. How to use comment in C#
  3. How to use variables in C#
  4. How to use keywords in C#