This lesson introduces you to C# Namespaces. Our objectives are as follows:
• Understand what Namespace is.
• Learn how to implement the using directive.
• Learn to use alias directive.
• Understand what are namespace members.

In Lesson 1, you saw the using System; directive in the SimpleHello program. This directive allowed you to use members of the System namespace. Because of the narrow focus of that lesson, we needed to delay explanation until now. When you’ve completed this lesson you will understand the using directive and more.

Namespaces are C# program elements designed to help you organize your programs. They also provide assistance in avoiding name clashes between two sets of code. Implementing Namespaces in your own code is a good habit because it is likely to save you from problems later when you want to reuse some of your code.

Namespaces don’t correspond to file or directory names. If naming directories and files to correspond to namespaces helps you organize your code, then you may do so, but it is not required.

Download pdf C# Namespaces