My colleague insists on explicitly specifying the namespace in code as opposed to using the using directive. In other words he wants to use the fully qualified name for each type every time this type occurs in code. Something like
public class MyClass
{
public static void Main()
{
System.Console.WriteLine("Foo");
}
}
instead of:
using System;
public class MyClass
{
public static void Main()
{
Console.WriteLine("Foo");
}
}
You can imagine the consequences.
The pros he gives:
My cons:
What do you think about this?
If you need to copy and paste code around so much as to actually benefit of having fully qualified types, you've got bigger problems.
Also, do you plan on remembering which namespace every single class is in in order to be able to type it fully qualified?
For a slightly different answer: LINQ.
Extension methods are obtained only via "using" statements. So either the query syntax or the fluent interface will only work with the right "using" statements.
Even without LINQ, I'd say use "using"... reasoning that the more you can understand in fewer characters, the better. Some namespaces are very deep, but add no value to your code.
There are other extension methods too (not just LINQ) that would suffer the same; sure, you can use the static class, but the fluent interface is more expressive.
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