Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27351

Style question: Import a namespace or fully-qualify a reference?

$
0
0
I noticed that in some compiler-generated code (e.g. that generated for handling a database table) object references tend to be fully qualified (e.g. Global.System.Xml.XmlTextReader rather than importing Global.System.Xml at the top and just using XmlTextReader in the code). I can see that, since it is compiler-generated, it is no extra work to emit the FQON, though it sure makes the result harder to read, at least for me. (I tend to favor lots of white space and short expressions -- easier on the eyes I find.)

This prompts me to ask a few questions:

1. What are the pros and cons of using fully-qualified references like these vs. importing the requisite namespaces and just using the object names?

2. When I develop a class to be used by others as source, would it be better form to use FQONs or to Import the namespaces I need?

Viewing all articles
Browse latest Browse all 27351

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>