Section 2. Fundamentals. 2.1 C# Comments

Comments can be used to explain C# code, and to make it more readable. It can also be used to prevent execution when testing alternative code.

Single-line Comments

Single-line comments start with two forward slashes (//). Any text between // and the end of the line is ignored by C# (will not be executed). The example below uses a single-line comment before a line of code and a single-line comment at the end of a line of code.

The example program uses a single-line comment before a line of code and a single-line comment at the end of a line of code.

C# Multi-line Comments

Multi-line comments start with /* and ends with */. Any text between /* and */ will be ignored by C#.

The example below uses a multi-line comment (a comment block) to explain the code.

The example uses a multi-line comment (a comment block) to explain the code

Wrapping out

It is up to you which comments do you want to use. We use // for short comments, and /* */ for longer comments.

Thank you for reading.

Check for more tutorials at acoptex.lt.

Check for Arduino and Raspberry Pi projects on our website acoptex.com.

Section 1. Introduction. 1.1 C# programming language

Section 1. Introduction. 1.2 Introduction to .NET Framework

Section 1. Introduction. 1.3 C# versions history

Section 1. Introduction. 1.4 C# vs Java

Section 1. Introduction. 1.5 C# get started

Section 1. Introduction. 1.6 Your first program – Hello world

Section 1. Introduction. 1.7 C# identifiers and keywords

Section 2. Fundamentals. 2.1 C# Comments

Section 2. Fundamentals. 2.2 C# Data types

Section 2. Fundamentals. 2.3 C# Constants and Literals