如何从另一个c#源文件导入静态方法并在没有"点"的情况下使用它?
喜欢 :
foo.cs
namespace foo
{
public static class bar
{
public static void foobar()
{
}
}
}
Run Code Online (Sandbox Code Playgroud)
Program.cs中
using foo.bar.foobar; <= can't!
namespace Program
{
class Program
{
static void Main(string[] args)
{
foobar();
}
}
}
Run Code Online (Sandbox Code Playgroud)
我不能只是foobar();,但如果我写using foo;在顶部并foobar()尽可能地打电话foo.bar.foobar(),尽管很冗长.对此有任何解决方法吗?