What are the guidelines for avoiding namespace and type name conflicts in C#?

The guidelines are very clear: namespaces outside of System should be Company.Technology. This allows both clear disambiguation and makes it easier for users to discover what namespaces are associated with what technologies. Remember, the primary purpose of a namespace is not collision avoidance, but rather developer productivity.

Guidelines are here:

http://msdn.microsoft.com/en-us/library/893ke618(v=vs.71).aspx

Your namespace should be something like:

namespace MrtsCorp.Robotics 
{
  public sealed class Robot 
  {
     ...

If you want to look at a reasonable model for such a namespace, try these:

http://msdn.microsoft.com/en-us/library/dd159952.aspx

I am not thrilled with namespaces with names like Ccr, which are clear only to domain experts, but Microsoft.Robotics.Simulation is nicely descriptive.


The easiest workaround, if you really can't come up with anything, is to call the namespace Robots.


From the Framework Design Guidelines on Names of Namespaces a namespace should be in the following format:

<Company>.(<Product>|<Technology>)[.<Feature>][.<Subnamespace>]

so since the "company" here is the open source project team for Hubot and really none of the other categories apply here then for your example it would be something like:

namespace HubotDev.Hubot
{
    public sealed class Robot
    {
       //...
    }
}

And the useage would be

Hubot.Robot robot = //...;

Tags:

C#

Namespaces