On the basis of our previous namespace discussion, we can deduce the syntax for writing compilation units, using statements, and namespaces. This has been done in Syntax Box 15.1, which makes heavy use of the optional [] brackets because the using statements, namespace definitions, and type definitions in a compilation unit and inside a namespace are optional.
Syntax Box 15.1 Compilation Units, Using Statements and NamespacesCompilation_unit::= [[<using_statement_1>] [<using_statement_2>] ...] [[<Namespace_definition_1>] [<Namespace_definition_2>] ...] [[<Type_definition_1>] [<Type_definition_2>] ...] where <using_statement> ::= using <Namespace_name> ; <Namespace_definition>::= <Short_namespace_name> { [[<using_statement_1>] [<using_statement_2>] ...] [[<Namespace_definition_1>] [<Namespace_definition_2>] ...] [[<Type_definition_1>] [<Type_definition_2>] ...] } <Type_definition> ::= <class_definition> ::= <struct_definition> ::= <enum_definition> ::= <interface_definition> ::= <delegate_definition> Notes:
However, this construct cannot be nested inside another namespace. |