How do I add comments in the source code?
Category: Introduction, viewed: 2K time(s).
A well written program usually become a document for itself. Using a good and descriptive fields or method names for example helps the reader of the code to understand the code better.
To intentionally adds comments to our program we can use a single-line comment or a multi-line comments. A single line comment starts with a double forward slash (//) and continues to the end of the line. The multi-line comment starts with /* and ends with */ symbol and it can span in multiple lines.
There is also a documentation comment that contains some XML-formatted data that can be use to create a documentation for classes or methods. This type of documentation can be extracted from the source code to create a documentation file. An example is shown in the sayHello(string name) method in the snippet below.