How can I import a static method from another c# source file and use it without "dots"?
like:
foo.cs
namespace foo
{
public static class bar
{
public static void foobar()
{
}
}
}
Program.cs
using foo.bar.foobar; // <= can't!
namespace Program
{
class Program
{
static void Main(string[] args)
{
foobar();
}
}
}
I can't just foobar();
, but if I write using foo;
on the top and call foobar()
as foo.bar.foobar()
it works, despite being much verbose. Any workarounds to this?
using foo;
thenbar.foobar()
is all you need to invoke it. With a static method, you're always going to have at least one dot. – Starchy