tags:

views:

210

answers:

1

Hi,

I can already do:

using System.Windows.Forms;
Button b;

or:

System.Windows.Forms.Button b;

but I would like to do:

using System.Windows;
Forms.Button b;

(because Button is ambiguous with another namespace, and typing System.Windows.Forms.Button is too long).

However this gives me an error, how can I achieve this?

Thanks

+9  A: 

A namespace alias perhaps:

using Forms = System.Windows.Forms;

The "using System.Windows" is now superfluous unless you use classes in that namespace.

Peter Lillevold
Thanks!‌‌‌‌‌‌‌‌‌‌
Laurent
+1 although the first using statement is redundant
AdamRalph
@Laurent - you're welcome.@AdamRalph - you're so right :)
Peter Lillevold
@AdamRalph: Maybe not in the OP's context.
Cerebrus
@Cerebrus - so I made sure to have an unless disclosure
Peter Lillevold