UJ <fr**@nowhere.com> wrote:
What's the general feeling on using the using keyword versus spelling the
type out completely.
For instance, do most people put a using in so they can just say
MyNewType or do people not use a using and they specify the
namespace/type like MyNameSpace.MyNewType
Just curious. I'm leaning towards not using the using and specifying things
because then I know for a fact it's my datatype not a system datatype.
You'll find that your code is much more long-winded. Of course, you can
hover over a variable to find out its full type (IIRC) if you really
need to - but most of the time you shouldn't need to. If you avoid
giving your types the same name as common system ones, it shouldn't be
a problem.
I've worked with code which (to me) didn't have enough "using"
statements. It gets very annoying very quickly. Consider:
System.Text.RegularExpressions.Regex regex = new
System.Text.RegularExpressions.Regex (".*");
compared with:
Regex regex = new Regex(".*");
Which of them makes the most important bits of the code (which for me
are the type name, the fact that you're calling a constructor, and the
pattern) the clearest? How important is the namespace in that, really?
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog:
http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too