C# Comments – Programming, Pseudocode Example, C# Programming Example
C# C# Console

C# Comments

C# comments (or comments in any programming language, for that matter) are pieces of text that you add to a program in order to communicate something to a human reader. That’s pretty much it.

The compiler ignores comments. Don’t worry about comments slowing down performance. Comments do contribute to the overall size of the source code, but that shouldn’t concern you either. Disk space gets cheaper each year, and so does internet connection. You don’t need to lose sleep over a handful of extra bytes being stored and transmitted.

Single Line Comments

Single line comments are exactly what their name suggests: comments that span a single line. To start a single line comment, you use two forward slashes (//). Everything that comes after is considered a comment. Here’s an example:

Multi-Line Comments

Next, we have another very descriptive name. Multi-line comments are comments that span multiple lines. You start such a comment with the “/” delimiter and end it with the “/” delimiter. Everything inside the delimiters is a comment. Consider the following example:

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.