Service Locator: Get all exports

Viewed 1192

I'm using MEF and I have two exports having the same contract type but with different contract name

Eg:

[Export("TypeA", typeof(MyPlugin))]
[Export("TypeB", typeof(MyPlugin))]

I could retrieve each exports using its respective contract name:

ServiceLocator.GetExportedValues<MyPlugin>("TypeA");

But now I wish to retrieve all instances implementing MyPlugin. is there any way I could do it?

I've tried using the following code:

ServiceLocator.GetExportedValues<MyPlugin>();

But it did not work. Apparently it is used to retrieve only implementations with no specific contract name.

Any opinion?

3 Answers
Related