I was wondering this as I apparently cannot do this. I have added my .dll as as reference and have added using myNamespace;
but whenever I want to call one of the functions, I have to use
myClass.myMethod();
is there anything I can do so I wont need to reference the class name when calling a procedure? So I would only need
myMethod();
You cannot do that in any way in current C#. using
just puts the namespace into your code so you don't have to explicitly write it each time you need it.
If your class is static
and you are using C# 6.0, you can do this:
using static System.Console;
private static void Main(string[] args)
{
WriteLine("test");
}
You can't for now. But in C# 6.0
you will be able able to use using directives for static
classes.
For example:
using System.Console;
// ...
Write(4);
You can see the detailed list for all features here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With