2 <clause number="9.3.2" title="Comments">
3 <paragraph>Two forms of comments are supported: delimited comments and single-line comments. </paragraph>
4 <paragraph>A delimited comment begins with the characters /* and ends with the characters */. Delimited comments can occupy a portion of a line, a single line, or multiple lines. <example>[Example: The example <code_example><![CDATA[
5 /* Hello, world program
6 This program writes "hello, world" to the console
11 System.Console.WriteLine("hello, world");
14 ]]></code_example>includes a delimited comment. end example]</example> </paragraph>
15 <paragraph>A single-line comment begins with the characters // and extends to the end of the line. <example>[Example: The example <code_example><![CDATA[
16 // Hello, world program
17 // This program writes "hello, world" to the console
19 class Hello // any name will do for this class
21 static void Main() { // this method must be named "Main"
22 System.Console.WriteLine("hello, world");
25 ]]></code_example>shows several single-line comments. end example]</example> <grammar_production><name>comment</name> :: <rhs><non_terminal where="9.3.2">single-line-comment</non_terminal></rhs><rhs><non_terminal where="9.3.2">delimited-comment</non_terminal></rhs></grammar_production><grammar_production><name><non_terminal where="9.3.2">single-line-comment</non_terminal></name> :: <rhs><terminal>//</terminal><non_terminal where="9.3.2">input-characters</non_terminal><opt/></rhs></grammar_production><grammar_production><name><non_terminal where="9.3.2">input-character</non_terminal>s</name> :: <rhs><non_terminal where="9.3.2">input-character</non_terminal></rhs><rhs><non_terminal where="9.3.2">input-characters</non_terminal><non_terminal where="9.3.2">input-character</non_terminal></rhs></grammar_production><grammar_production><name><non_terminal where="9.3.2">input-character</non_terminal></name> :: <rhs>Any Unicode character except a <non_terminal where="9.3.2">new-line-character</non_terminal> </rhs></grammar_production><grammar_production><name><non_terminal where="9.3.2">new-line-character</non_terminal></name> :: <rhs>Carriage return character (U+000D) </rhs><rhs>Line feed character (U+000A) </rhs><rhs>Line separator character (U+2028) </rhs><rhs>Paragraph separator character (U+2029) </rhs></grammar_production><grammar_production><name><non_terminal where="9.3.2">delimited-comment</non_terminal></name> :: <rhs><terminal>/*</terminal><non_terminal where="9.3.2">delimited-comment-characters</non_terminal><opt/><terminal>*/</terminal></rhs></grammar_production><grammar_production><name><non_terminal where="9.3.2">delimited-comment-character</non_terminal>s</name> :: <rhs><non_terminal where="9.3.2">delimited-comment-character</non_terminal></rhs><rhs><non_terminal where="9.3.2">delimited-comment-characters</non_terminal><non_terminal where="9.3.2">delimited-comment-character</non_terminal></rhs></grammar_production><grammar_production><name><non_terminal where="9.3.2">delimited-comment-character</non_terminal></name> :: <rhs><non_terminal where="9.3.2">not-asterisk</non_terminal></rhs><rhs><terminal>*</terminal><non_terminal where="9.3.2">not-slash</non_terminal></rhs></grammar_production><grammar_production><name><non_terminal where="9.3.2">not-asterisk</non_terminal></name> :: <rhs>Any Unicode character except * </rhs></grammar_production><grammar_production><name><non_terminal where="9.3.2">not-slash</non_terminal></name> :: <rhs>Any Unicode character except / </rhs></grammar_production></paragraph>
26 <paragraph>Comments do not nest. The character sequences /* and */ have no special meaning within a single-line comment, and the character sequences // and /* have no special meaning within a delimited comment. </paragraph>
27 <paragraph>Comments are not processed within character and string literals. </paragraph>