6. Source Files and Namespaces
A Visual Basic .NET program consists of one or more source files. When a program is compiled, all of the source files are processed together; thus, source files can depend on each other, possibly in a circular fashion, without any forward-declaration requirement. The textual order of declarations in the program text is generally of no significance.
A source file consists of an optional set of option statements, import statements, and attributes, which are followed by a namespace body. The attributes, which must each have either the Assembly or Module modifier, apply to the .NET assembly or module produced by the compilation. The body of the source file functions as an implicit namespace declaration for the global namespace, meaning that all declarations at the top level of a source file are placed in the global namespace. For example:
File A.vb: Class A End Class File B.vb: Class B End Class
The two source files contribute to the global namespace, in this case declaring two classes with the fully qualified names
B. Because the two source files contribute to the same declaration space, it would have been an error if each contained a declaration of a member with the same name.
The compilation environment may override the namespace declarations into which a source file is implicitly placed.
Start ::= [ OptionStatement+ ] [ ImportsStatement+ ] [ Attributes ] [ NamespaceMemberDeclaration+ ]