Namespace Syntax

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 Namespaces

						Compilation_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>] ...

Get C# Primer Plus now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.