getting all instances of IFoo from MEF aggregatecatalog in silverlight
I am sure this cant be hard - can it?
the only func开发者_开发知识库tion seems to be GetExports but that seems to take 2 generic parameters plus a ExportDefintion that itself takes 5 values including a lambda - surely not? I thought I could do something like agcat.GetExports<IFoo>()
You don't get instances from a catalog you get them from a container.
var container = new CompositionContainer(agCat);
var foos = container.GetExports<IFoo>(); // Or GetExportedValues<IFoo>()
精彩评论