<tfoot id='SDCPz'></tfoot>
    1. <i id='SDCPz'><tr id='SDCPz'><dt id='SDCPz'><q id='SDCPz'><span id='SDCPz'><b id='SDCPz'><form id='SDCPz'><ins id='SDCPz'></ins><ul id='SDCPz'></ul><sub id='SDCPz'></sub></form><legend id='SDCPz'></legend><bdo id='SDCPz'><pre id='SDCPz'><center id='SDCPz'></center></pre></bdo></b><th id='SDCPz'></th></span></q></dt></tr></i><div id='SDCPz'><tfoot id='SDCPz'></tfoot><dl id='SDCPz'><fieldset id='SDCPz'></fieldset></dl></div>
      • <bdo id='SDCPz'></bdo><ul id='SDCPz'></ul>

      <small id='SDCPz'></small><noframes id='SDCPz'>

      <legend id='SDCPz'><style id='SDCPz'><dir id='SDCPz'><q id='SDCPz'></q></dir></style></legend>

      如何避免一个类和它的命名空间同名,例如 Technology.Technology?

      How to avoid having the same name for a class and it#39;s namespace, such as Technology.Technology?(如何避免一个类和它的命名空间同名,例如 Technology.Technology?)

      • <bdo id='iiZmL'></bdo><ul id='iiZmL'></ul>

              <legend id='iiZmL'><style id='iiZmL'><dir id='iiZmL'><q id='iiZmL'></q></dir></style></legend>

              <small id='iiZmL'></small><noframes id='iiZmL'>

              <tfoot id='iiZmL'></tfoot>

                <i id='iiZmL'><tr id='iiZmL'><dt id='iiZmL'><q id='iiZmL'><span id='iiZmL'><b id='iiZmL'><form id='iiZmL'><ins id='iiZmL'></ins><ul id='iiZmL'></ul><sub id='iiZmL'></sub></form><legend id='iiZmL'></legend><bdo id='iiZmL'><pre id='iiZmL'><center id='iiZmL'></center></pre></bdo></b><th id='iiZmL'></th></span></q></dt></tr></i><div id='iiZmL'><tfoot id='iiZmL'></tfoot><dl id='iiZmL'><fieldset id='iiZmL'></fieldset></dl></div>
                  <tbody id='iiZmL'></tbody>
                本文介绍了如何避免一个类和它的命名空间同名,例如 Technology.Technology?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!



                I am frequently having naming conflicts between a namespace and a class within that namespace and would like to know a best practice for handling this when it seems to make sense to use these names in the first place, besides adding random prefixes.

                拥有一个 Models.Technology 命名空间似乎很有意义,其中包含数十个技术类(即武器、农业、回收技术)和一些相关接口.我还决定在 Technology 命名空间中创建一个 Technology 抽象类,所有技术都从该类派生.

                It seemed to make sense to have a Models.Technology namespace, with dozens of technology classes (ie. Weapon, Agricultural, Recycling technologies) and some related interfaces in it. I also decided to have a Technology abstract class, in the Technology namespace, from which all technologies derive.


                However, this is forcing me to use code like this:

                public Technology.Technology research(Technology.Technology tech) {...}


                public Building.Building build(int count) {...}

                顺便说一下,我没有命名我的命名空间 Technologies,因为我在其他地方使用该术语作为可用技术列表的包装器......

                By the way I did not name my namespace Technologies since I use that term elsewhere as a wrapper for a list of available technologies...



                Without more precise indications on when you encounter this problem it's hard to give you some general advice.

                但是我会假设当您的命名空间中有一个基类并且其他类从它继承时,您会遇到这个问题.如果是这种情况,您可以调用您的类 BaseTechnology(基类)或 AbstractBuilding(抽象类)或 IAnimal(接口).这甚至可以让您更加清晰,因为您在类型的名称中指定了一些重要的内容.

                But I'm gonna suppose you have this problem when you have a base class in your namespace, with others classes inheriting from it. If that's the case you could call your class BaseTechnology (base class) or AbstractBuilding (abstract class) or IAnimal (interface). This even give you more clarity since you specify in the name of your type something important about it.

                这篇关于如何避免一个类和它的命名空间同名,例如 Technology.Technology?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!



                C# namespace alias - what#39;s the point?(C# 命名空间别名 - 有什么意义?)
                Using Xpath With Default Namespace in C#(在 C# 中使用具有默认命名空间的 Xpath)
                Generating an EDMX from a DB2 Database(从 DB2 数据库生成 EDMX)
                IBM .NET Data Provider Connection String issue with Library List(库列表的 IBM .NET 数据提供程序连接字符串问题)
                .NET DB2 OLEDB pre-requisites(.NET DB2 OLEDB 先决条件)
                Referring to Code in IBM.Data.DB2 makes that Assembly Unavailable to the rest of my Solution(引用 IBM.Data.DB2 中的代码使该程序集对我的解决方案的其余部分不可用)

              • <tfoot id='KHl48'></tfoot>

                <small id='KHl48'></small><noframes id='KHl48'>

                      • <i id='KHl48'><tr id='KHl48'><dt id='KHl48'><q id='KHl48'><span id='KHl48'><b id='KHl48'><form id='KHl48'><ins id='KHl48'></ins><ul id='KHl48'></ul><sub id='KHl48'></sub></form><legend id='KHl48'></legend><bdo id='KHl48'><pre id='KHl48'><center id='KHl48'></center></pre></bdo></b><th id='KHl48'></th></span></q></dt></tr></i><div id='KHl48'><tfoot id='KHl48'></tfoot><dl id='KHl48'><fieldset id='KHl48'></fieldset></dl></div>
                        <legend id='KHl48'><style id='KHl48'><dir id='KHl48'><q id='KHl48'></q></dir></style></legend>

                          <bdo id='KHl48'></bdo><ul id='KHl48'></ul>
                            <tbody id='KHl48'></tbody>