O'Reilly logo

C# Primer Plus by Klaus Michelsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Nested Namespaces

Apart from writing namespaces beside each other, as demonstrated in Listing 15.2, you can also nest namespaces inside other namespaces as mentioned earlier. The following scenario provides an example of a typical situation where namespace nesting would be convenient.

Suppose the editors at Sams Publishing wanted to provide a convenient way for programmers to reuse the code written in several of their C# books, including this one. An overall namespace hierarchy for doing this could look like that shown in Listing 15.3. An outermost namespace called Sams contains namespaces beside each other, named after each of Sams C# books (for brevity sake, only the two namespaces CSharpPrimerPlus and SamsTeachYourselfCSharpIn21Days have been ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required