Expose a Class from a Referenced Assembly

J

jheising

All,

I'm wondering if anyone can help with a small little issue I'm having.

Here's the hypothetical situation:

I have an Assembly called FooBaseAssembly with a classed called
FooBase.

I have another Assembly called FooMaster which has a reference to
FooBase.

I want to expose the FooBase class (or a subclass of it, I really don't
care) from FooMaster without requiring the developer to have to
reference FooBase.

Bascially, I want the developer to be able to add a reference to the
the FooMaster class ONLY (and not have to worry about FooBase), but
have access to the FooBase class as well.

I've tried creating a subclass in FooMaster (like FooBaseSubclass :
FooBase), but when I try to compile code which references FooMaster and
creates a FooBaseSubclass I get a compiler error "FooBase is defined in
an assembly that is not referenced. You must add a reference to
assembly FooBase".

Does C# support this type of arrangement? Or does it need a reference
to each and every single base class exposed from a subclass?

Any help would be greatly appreciated!
 
D

DotNet Coder

I have tried for awhile to get a situation like this to work with little
success. Think of it as a cascade effect. If you reference
ChildAssembly.Class1 that inherits from MasterAssembly.Class1, then you
must have a reference to ChildAssembly and MasterAssembly for the
complier to properly link it all.

Hmmm, kind of reminds me of DLL hell all over again. lol ;-)

HTH,
~d
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top