Cyclic namespaces in C #
No risk - feel free to reference whatever you want on the same assembly.
However, this approach will make your application fragile and difficult to scale. The best approach is to try to keep your components as orthogonal as possible.
What the language and the compiler allow you to do is not necessarily what's best for long term development needs (bug fixes, scaling, new features, etc.). You should strive for free connection and high cohesion .
a source to share
namespaces are a way to provide a logical organization for your code. They provide the ability to reuse names by applying them in a specific context. There is nothing wrong with classes in two namespaces depending on each other.
Cyclic depedance in assemblies is a little more complicated. Last I checked, visual studio does not directly resolve this type of relationship.
a source to share
I don't think there are any risks per se, and in some cases this is naturally the natural way of doing things. System.Text.StringBuilder
obviously does System.String
, and I would be very surprised if nothing in the namespace System
was used StringBuilder
.
It's probably worth just checking your design as often as possible: ask the question if you can split the functionality into separate components. Quite often the answer will be "no", and then just proceed without guilt :)
a source to share