>Not necessarily. The place that you reference the derived class from
isn't necessarily somewhere that actually includes the base class
assembly - quite often you build to separate directories, and only at
runtime would you put them all in the same directory. How would it know
where it should reference the base class assembly from?
When I build myEXE.exe project, it imports the derived class in the
output folder of myEXE.exe. I believe every one agrees with this. It
is always the case (from my observations). Now, go back a little in
time. I build the derived class, which imports the base class into its
output directory. Ok, now the derived and base are in the same
directory. I've never seen it do otherwise. Now move foward in time
and build the EXE. It imports the derived, which knows where its base
is and can drag the base along. How do I know it knows where the base
is? Because the derived class project imported it into the derive's
output folder. The compiler knew exactly where the base originated
(via the DLL file reference in the derived class project that some
developer setup) and knew exactly where the derived project's output
folder is for copying the base class (either setup by default or a
developer). All of this is now known. Here's what happens next.
C# compiles myEXE.exe and includes the derived class because it knows
this location as explained above. The base class doesn't come along
because the C# compiler disregards using its own information about
where the base is. Remember, all of this knowledge is readily
available as explained in the first paragraph. Why did the C# compiler
choose to disregard it? Who knows - budget, good developers left the
team before code complete, time constraints. What ever the reason, the
base is not there. Us developers are now forced to include this
entire chain of derivation explicitly since the C# compiler refuses to
help us out and simply use its own knowledge about the base class
location and import the base into the myEXE.exe project output folder.
The implicit import only goes back one DLL and no further, as many in
this group have pointed out and learned (sometimes the hard way).
Again, if you like taking time out to include your entire derived
chain, by all means, it is your privilege. I on the other hand would
rather be doing something slightly more productive and less mundane.
Brett