As we know a namespaces is a set of related classes. A namespace may also contain other namespaces. Today we will discuss about the System namespace. The System namespace contains the classes that most applications use for interacting with the operating system. You can refer to objects in namespaces by prefixing them explicitly with the identifier of the namespace. For example the System namespace contains the Console class, which provides several methods, including WriteLine.
You can access the WriteLine method of the Console class as follows:
Using Directive: We can specify a namespace by placing a using directive at the beginning of our application before the first class is defined. We use the using directive so that we need not to write the namespace name always when we want to use any method of that particular class. A using directive specifies a namespace that will be examined if a class is not explicitly defined in the application. We can also use more than one using directive but all these should be putting on the top before the first class is used. Here are some example :
After specify the namespace with using directive at the top now we can use the method of that namespace directly using the following example: