C.6. Naming namespaces

Like Java package names, C# namespaces should be unique so that the chance of another development team somewhere across the globe choosing an identical name is extremely small.

While Java recommends that you name your Java packages using your company's allocated domain name on the world wide web, Microsoft recommends that you name your C# namespaces like this:

<CompanyName>.<TechnologyName>

For example, a class written by Addison-Wesley's technical department can be placed into the AddisonWesley.TechDept namespace. TechDept can be further divided into multiple namespaces based on the project title.

Additional notes

  • Use plural nouns where appropriate. For example, AddisonWesley. TechDept.SharedUtilities is preferable to AddisonWesley.TechDept. SharedUtility.

  • Avoid giving a class the same name as a namespace. If you already have a SharedUtility namespace, try not to have a class of that name.

  • In the same way that you should avoid putting your Java classes into the java.lang package, you should also avoid using the System namespace for your own classes, even though nothing prevents you from doing so. Other namespace identifiers to avoid include words like Collections, Forms, and UI.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.216.27.251