In all but a few circumstances, I'd say, import
or using
the namespaces is the best practice. This has the added advantage of early degradation: the compiler will complain if it cannot find the namespace.
Among the few circumstances where the fully qualified name is needed (to be more correct: it is not fully qualified, you do not specify the version or key) are where name collisions would occur (i.e.: when two namespaces happen to have the same name, I see this happen often with the Util
classes that many vendors add to their libs) (note that you can alias class names using using
). Or when you need to qualify the name as a string, but that's another use-case (i.e., with reflection). Occasionally, while debugging, it helps to use the FQN, because the debugger does not allow adding a using
directive.
In the event you use the name only once, you may be tempted to use the FQN, but in my experience, you'll quickly find yourself using more than one name of the namespace and refactor it to importing the namespace in the header.