June 2003
Intermediate to advanced
624 pages
12h 41m
English
The last OOP topic we'll look at in this chapter is how to create your own namespaces. As you know, namespaces let you divide programs up to avoid clashes between identifiers (even if you don't declare your own namespace, your code is given its own default namespace, the global namespace). To create your own namespace, you use the namespace keyword:
namespace name[.name1] ...] { type-declarations }
Here are the parts of this statement:
name, name1— A namespace name can be any legal identifier, and it can include periods.
type-declarations— Within a namespace, you can declare one or more of the following types: another namespace, a class, interface, struct, enum, or delegate.
You can create as many namespaces in a file as ...