Her is Question: Why do standard libraries for C# need both an assembly reference and an import?

Her is Question: Why do standard libraries for C# need both an assembly reference and an import?
What is the reason that I have to do both of these for the standard libraries? For every other language that I have used, I only have to do one to access standard libraries.

An assembly reference makes the code in the assembly available to another assembly. A using directive makes the types of another namespace available to a given source file. These are completely separate concepts. If you were inclined, you could get away with never using the usings directive and using fully-qualified type names. Similarly, it is possible to use the usings directive to refer to other namespaces within the same assembly.
Also, there is a perfect analog between assemblies/jars and usings/import between Java and C# for the purposes of this discussion. So C# is hardly unique here.

0 comments: