References, dependencies, derived classes – should what I’m trying to do be possible?

I'll try to describe this scenario as best I can. Let's say we have VendorStuff.dll inside of which they have a base class definition WidgetBase. The vendor has their own implementations for BlueWidget : WidgetBase and RedWidget : WidgetBase. These get used in some sort of WidgetWork(WidgetBase W) method and out pops a result.

Here I am building CustomerStuff.dll Now of course I think I can implement my own widget that's even better than the vendor implementations, so I reference the vendor dll and create MyWidget : WidgetBase with the appropriately overridden methods, etc.

Should I expect that the vendor "WidgetWork()" method should be able to use MyWidget, even though VendorStuff.dll didn't reference CustomerStuff.dll when it was built?

I did try it and it doesn't work… but obviously the above example is a massive simplification of a process with a lot of moving parts, and I plan on following up with Vendor to get their thoughts on where it might be falling over. I'm more curious on a fundamental level if the runtime should be able to resolve those dependencies and to use my derived class at all.

Thanks!

by therealjerseytom via /r/csharp

Leave a Reply