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

More About the using Directive

As you know, the using keyword, followed by a suitable namespace name, allows us to abbreviate a class's long fully-qualified name when we refer to it in the source code. Consequently, if we were to use the classes from the two namespaces Sams.CSharpPrimerPlus.ElevatorSimulation and Sams.CSharpPrimerPlus.BankSimulation (defined in Listing 15.3) in the source code of Figure 15.1, we could use the short classnames of the classes belonging to these namespaces by including lines 1 and 2 shown in Figure 15.1.

Figure 15.1. The compiler cannot know to which namespace Building belongs.

But what if both namespaces referenced ...

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