Can i name a C# namespace starting with a number?
I'开发者_开发知识库m on a Mac and can't try it for myself right now.
For example, will this compile:
namespace 2something.something.else { }
No, you can't. A namespace name is an identifier and the grammar for the first character of identifiers is:
identifier_start_character
: letter_character
| '_'
;
That means that the first character has to be an underscore or a letter (including letters in non-Latin scripts, such as Arabic or Chinese).
You can't name a namespace starting with a number. You'll get a compiler error:
Identifier expected.
Nope you can't. You'll get Identifier expected
error
If you really need a number in front you can write it with words
TwoSomething.something.else { }
精彩评论