Hi Bruce:
You need the @ Assembly attribute to tell the compiler where the types
live. The compiler must know where the compiled code exists (what dll)
for the types you need to use.
@ Import is not required. You could reference a class like:
System.Data.SqlClient.SqlConnection connection;
But by importing the System.Data.SqlClient namespace, you can save
some typing and use:
SqlConnection connection;
The SqlConnection class (from the System.Data.SqlClient namespace)
could live in an assembly called foo.dll (it doesn't, but it could).
Since there is no relation between assembly name and the namespace(s)
it contains, the @ Assembly directive is still required to point the
compiler to the right assembly.
I'm not Petzold, so I hope this helps :)
--
Scott
http://www.OdeToCode.com
----------------------------------------------------------------------------------------------------------------------------------------------------------
My question - what's the point of having the two directives? It seems that
@ Import provides the information needed to reference the FCL classes. Why
do you, then, need to specify an Assembly, too? Isn't that redundant?
TIA,
-bruce