开发者

getting all instances of IFoo from MEF aggregatecatalog in silverlight

开发者 https://www.devze.com 2023-03-21 18:25 出处:网络
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

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>()
0

精彩评论

暂无评论...
验证码 换一张
取 消