Reputation: 4435
I have a class called Message
. It is located inside MyProgram
namespace. The problem is that System.Windows.Forms
has also a Message
class, so whenever I want to use classes from both of the namespaces, I need to write MyProgram.Message
to refer to my class, which is very tedious.
I hoped this line could work:
using static Message = MyProgram.Message;
but I get the following error:
a 'using static' directive cannot be used to declare an alias
Is there a way to force the code to recognize Message
as MyProgram.Message
? Also, changing my class's name is not a real solution. :P
Upvotes: 2
Views: 1089
Reputation: 887767
using static
is for static members, not nested types.
A regular using
directive will work fine.
using Message = MyProgram.Message;
Upvotes: 3