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 ...
Get C# Primer Plus now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.