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 .



From Java to C#. A Developers Guide
From Java to C#: A Developers Guide
ISBN: 0321136225
EAN: 2147483647
Year: 2003
Pages: 221
Authors: Heng Ngee Mok

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net