Starting with Comments - CSharp Language Basics

CSharp examples for Language Basics:Hello World

Introduction

In C#, you can use three types of comments:

  • One-line comments
  • Multiline comments
  • Documentation comments

One-Line Comments

One-line comments have the following format:

// comment text

Multiline Comments

To start a multiline comment, you enter a forward slash followed by an asterisk:

/*

this is a test

*/

The following is a comment:

/* this is a comment */

The following is also a comment:

/* this is
a comment that
is on
a number of
lines */

You can also enter this comment as the following:

// this is
// a comment that
// is on
// a number of
// lines

Related Tutorials