【发布时间】:2015-04-08 15:53:36
【问题描述】:
我在来自不同类的两个方法之间有一个模棱两可的引用。
这些类位于共享相同结构的不同命名空间中,例如:
MyApp.Models.Folder1.Class1
MyApp.Models.Folder2.Class2
为什么我不能这样使用?
using MyApp.Models;
//and use this static method
Folder1.Class1.StaticMethod();
还有什么方法可以将命名空间仅用于方法吗?喜欢:
[using(MyApp.Models.Folder1)]
public ContentResult SomeGetMethod(){
if(Class1.StaticBooleanMethod()) return "nice baby!";
return "that was horrible!";
}
【问题讨论】:
标签: c# asp.net-mvc namespaces data-annotations