Skip to Content
Microsoft® Visual C#® .NET 2003 Kick Start
book

Microsoft® Visual C#® .NET 2003 Kick Start

by Steven Holzner
June 2003
Intermediate to advanced
624 pages
12h 41m
English
Sams
Content preview from Microsoft® Visual C#® .NET 2003 Kick Start

Creating Namespaces

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

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Microsoft® .NET Kick Start

Microsoft® .NET Kick Start

Hitesh Seth

Publisher Resources

ISBN: 0672325470Purchase book