Namespace Directives

Namespace directives are C# language elements that allow a program to identify namespaces that are used in a program. They allow namespace members to be used without specifying a fully qualified name. When using the entire namespace hierarchy to make a method call, a program uses a method's fully qualified name. If every statement in every method used fully qualified names, a program would be very wordy, redundant, and perhaps more difficult to read. C# has two namespace directives: using and alias.

The using Directive

The using directive permits specification of a method call without the mandatory use of a fully qualified name. Here's an example of the using directive:

 using System; class HowdyPartner { static void Main() ...

Get C# Unleashed 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.