Should a class have the same name as the namespace?

前端 未结 5 1536
陌清茗
陌清茗 2021-01-19 01:27

I\'m designing a namespace to hold a set of classes that will handle user related tasks for a several different applications. (Log-in, authenticate etc)

5条回答
  •  离开以前
    2021-01-19 01:59

    The namespace is Fusion.User
    Class Full Name would be Fusion.User.User

    It is a good practise to keep them different because

    1. It avoids confusion to the developer
    2. It also looks ugly in some cases like here we are using two user.

      using Fusion;
      namespace xyz {
      public class test
      {
      User.User userObject {get;set;}
      }
      }
      So the better option would be to use different names

提交回复
热议问题