使用或项目名称调用项目

sye*_*sin 1 c# oop using

是否更好地通过其类名使用另一个C#项目的类.像这样

 Buss_Logic.Class1 myClass1 = new Buss_Logic.Class1();
 Buss_Logic.Class2 myClass2 = new Buss_Logic.Class2();
Run Code Online (Sandbox Code Playgroud)

或通过using文件顶部的关键字

 using Buss_Logic; 
Run Code Online (Sandbox Code Playgroud)

Eri*_* J. 5

只要没有命名空间冲突,它就会使代码更紧凑/更容易,以包含带有using关键字的命名空间.

如果对类的定义位置有任何疑问,请将鼠标悬停在类名上.工具提示将显示完全限定的类名.

如果存在命名空间冲突,则使用显式命名空间(例如,File在两个不同的命名空间中调用两个类,其中当前源文档中需要两个类).