Naming of namespace and classes

Viewed 102

In C# there are some problems with naming a namespace the same as a class that is included in that namespace.

In my project, I often have the same situation. I have a class that represents an abstraction of an external device (a USB relay for example). The code for such a device looks like this:

namespace Hardware.ExampleDeviceNamespace 
{
   class ExampleDevice
   {
      void executeCommand( DeviceCommand command ) {...}
      void checkConnection( DeviceConnection connection ) {...}
   }

   class DeviceCommand
   {
      ...
   }

   class DeviceConnection
   {
      ...
   }
}

Now I am struggling with a proper name for the namespace ExampleDeviceNamespace and the class ExampleDevice, because I think adding the word "namespace" at the and of the actual name is not very nice. I am using a namespace for the ExampleDevice because I implemented a lot of helping classes like DeviceCommand and DeviceConnection and the namespace Hardware would get very messy without the folders. Do you have any suggestions to solve this problem? I am aware that of the fact, that there is no "right" solution for this question. But I would like to hear some ideas from other programmers.

If you have further questions to my problem, do not hesitate to ask. Thanks in advance for any answer.

0 Answers
Related