This project has moved. For the latest updates, please go here.

Is Export required?

Jul 21, 2009 at 3:03 PM

In my limited testing, I haven't been able to Import something that wasn't explicitly Exported.  Is there a way to say "Import anything that implements the ICanDoIt interface"?  If not, why?  Being able to import an interface that was not marked with [Export] would enable people to create plug-ins that did not reference or depend on MEF.


Jul 21, 2009 at 4:59 PM

If you can modify the ICanDoIt interface, you can put an InheritedExportAttribute on it:

public interface ICanDoIt { /* ... */ }

If you can't put the attribute on ICanDoIt, then there isn't a way to do this (without writing your own programming model).