William,
I am assuming that you are using the version of MEF that comes with .Net 4.5. Here are a couple of things to get you started.
Let’s assume that you have two classes that implement IPlugin
[Export(typeof(IPlugin))] //Add these attributes to make them discoverable to MEF.
Plugin1: IPlugin In Plugin1.dll
[Export(typeof(IPlugin))]
Plugin2: IPlugin In Plugin2.dll
In your Main in hosting application, you need to define a DirectoryCatalog with the path where the binaries are dropped.
var directoryCatalog=new DirectoryCatalog(“<BINPATH>”)
var container=new CompositionContainer(directoryCatalog)
IEnumerable<IPlugin> plugins= container.GetExportedValues<IPlugin>(); // GetPluginsViaMef2LolKThx[This is the implementation of your method
plugins should have Plugin1 and Plugin2
In case you want your plugins to be completely oblivious to the use of MEF, you can use registration builder to define rules.
var builder=new RegistrationBuilder();
builder.ForTypesDerivedFrom<IDisposable>().ExportInterfaces();
and pass that in to the DirectoryCatalog as follows.
var directoryCatalog=new DirectoryCatalog(“<BINPATH>”,builder)
hope that answers your question. (Excuse the email formatting)
cheers
-alok