A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/comments below:

// and /* */ - comments - C# reference

C# supports two different forms of comments. Single line comments start with // and end at the end of that line of code. Multiline comments start with /* and end with */. The following code shows an example of each:

// This is a single line comment.

/* This could be a summary of all the
   code that's in this class.
   You might add multiple paragraphs, or links to pages
   like https://learn.microsoft.com/dotnet/csharp.
   
   You could even include emojis. This example is 🔥
   Then, when you're done, close with
   */

The multi-line comment can also be used to insert text in a line of code. Because these comments have an explicit closing character, you can include more executable code after the comment:

public static int Add(int left, int right)
{
    return left /* first operand */ + right /* second operand */;
}

The single line comment can appear after executable code on the same line. The comment ends at the end of the text line:

return source++; // increment the source.

Some comments start with three slashes: ///. Triple-slash comments are XML documentation comments. The compiler reads these to produce human documentation. You can read more about XML doc comments in the section on triple-slash comments.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4