There is no clear-cut criterion. It's more like it.
Some people always prefer to use one way or another. Others prefer to switch depending on what is being used or even more how often it is used. If you're going to use a name only once, it's usually easier to write it in the place of use instead of doing an "import." But it has the drawback that takes away the consistency.
My personal observation is that it is rare to use the fully qualified name and there is preference for using
/ import
. The use of the full name is only adopted in most cases when there is a name conflict.
It is still possible to apply using
by creating an own alias in this way (credit for the dcastro in the comments):
using WF = System.Windows.Forms.
Then you use the created alias ( WF
) to disambiguate the names.
C # 6 should encourage the adoption of using
a little more since now static classes can be imported.
In other languages this may be different, but it seems that you have concerned yourself with C # and VB.Net secondarily. So ask yourself how many times have you seen someone using the first form.
Increasingly, it will be common to use:
using System;
using static System.Console; //C# 6
void Main() {
int i = 10; //raramente se usa o tipo do .Net, prefere-se o alias da linguagem
//ou usa-se o var mesmo, neste caso
WriteLine(i); //C# 6
}