Identical class names in different namespaces

前端 未结 6 1873
无人共我
无人共我 2021-01-11 13:33

I have two different namespaces, with lots of classes with the same name. I believe some code will make it easier to understand:

namespace Print.Pdl.PostScri         


        
6条回答
  •  醉酒成梦
    2021-01-11 14:33

    It's a tricky question IMO. To answer it well, you need to know how often people are likely to use both namespaces at once, and how annoyed they get at having to prefix everything with a namespace.

    I personally tend to lean towards the "different names". I think of the namespaces as a mechanism to limit the set of names visible in the code, and a safeguard against the unlikely event that names clash even within this reduced set. So keeping the clash "unlikely" is important. Therefore, I personally wouldn't design with a clash on purpose.

    Especially since in your case the difference is so small: BaseOperator is only a tad shorter than BasePsOperator.

提交回复
热议问题