logo
Учебник_ПОА

Creating Your Own Namespace

It is common to use namespaces when working on large programs. Using your own namespaces provides a degree of control over similarly named methods and types. For example, assume you are writing an application that loads both statistical data and image files from a disk. You could create two new namespaces, one called Images and one called StatisticalData. As you are using two separate namespaces, all the names of the methods defined in each namespace will be unique, even if the individual classes have the same name. This means you could have a class called FileHandling in both namespaces, both containing a method called Load. You could specify the class you wanted by referring to either StatisticalData.FileHandling or Images.FileHandling.

It is good practice to create a separate folder for each namespace in your Visual C# Express project.