MEF for Framework 3.5 和 MEF for Framework 4.0 之间有哪些基本区别?
获取窗口应用程序的链接
它在 Framework 3.5 中工作得很好,但是当我尝试为框架 4.0 开发相同的代码 无法找到以下功能,
return container.GetExportedObject<Form1>();
请给我一些使用 MEF 的窗口应用程序的正确示例,其中我的容器窗体上的所有用户控件
I try to below link for window application with MEF
it's work good in Framework 3.5 but when i try to develop same code for framework 4.0
not able to find below function
return container.GetExportedObject<Form1>();
please give me some properly example for window application with MEF where my container all the Usercontrols on Form
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MEF 是在 .NET 4.0 之前开发的,但从 .NET 4.0 开始它就成为框架的正式部分。您正在寻找的 API 实际上是
CompositionContainer
继承自的ExportProvider.GetExportedValue
方法:GetExportedObject
已重命名为GetExportedValue< /code>,它发生在 MEF 预览版 6 中,这意味着该博客文章实际上是基于 MEF 的早期修订版。
MEF was being developed pre-.NET 4.0 but it became an official part of the framework from .NET 4.0 forwards. The API you are looking for is actually the
ExportProvider.GetExportedValue<T>
method whichCompositionContainer
inherits from:GetExportedObject
was renamedGetExportedValue
, and it occurred with MEF preview 6, which means that blog post was actually based on quite an early revision of MEF.