X hits on this document





52 / 396

Chapter ‎18   Unsafe code

decimal-digit-character: A Unicode character of the class Nd A unicode-escape-sequence representing a character of the class Nd

connecting-character:   A Unicode character of the class Pc A unicode-escape-sequence representing a character of the class Pc

formatting-character:   A Unicode character of the class Cf A unicode-escape-sequence representing a character of the class Cf

For information on the Unicode character classes mentioned above, see The Unicode Standard, Version 3.0, section 4.5.

Examples of valid identifiers include “identifier1”, “_identifier2”, and “@if”.

An identifier in a conforming program must be in the canonical format defined by Unicode Normalization Form C, as defined by Unicode Standard Annex 15. The behavior when encountering an identifier not in Normalization Form C is implementation-defined; however, a diagnostic is not required.

The prefix “@” enables the use of keywords as identifiers, which is useful when interfacing with other programming languages. The character @ is not actually part of the identifier, so the identifier might be seen in other languages as a normal identifier, without the prefix. An identifier with an @ prefix is called a verbatim identifier. Use of the @ prefix for identifiers that are not keywords is permitted, but strongly discouraged as a matter of style.

The example:

class @class { public static void @static(bool @bool) { if (@bool) System.Console.WriteLine("true"); else System.Console.WriteLine("false"); } }

class Class1 { static void M() { cl\u0061ss.st\u0061tic(true); } }

defines a class named “class” with a static method named “static” that takes a parameter named “bool”. Note that since Unicode escapes are not permitted in keywords, the token “cl\u0061ss” is an identifier, and is the same identifier as “@class”.

Two identifiers are considered the same if they are identical after the following transformations are applied, in order:

The prefix “@”, if used, is removed.

Each unicode-escape-sequence is transformed into its corresponding Unicode character.

Any formatting-characters are removed.

Copyright Microsoft Corporation 1999-2003. All Rights Reserved.39

Document info
Document views1222
Page views1222
Page last viewedThu Jan 19 11:48:52 UTC 2017