C++ 中的简单 MEF 示例/ 命令行界面
任何人都可以用 C++/CLI 给出简单的 MEF 示例吗?
最美好的祝愿
PS:我尝试转换 C# 示例,但遇到困难...例如,
CompositionBatch^ batch = gcnew CompositionBatch();
batch->AddPart(this);
在 C++/CLI 中,我无法访问 CompositionBatch
类重载方法 AddPart(object attributePart)
的CompositionBatch
...编译器只看到AddPart(ComposablePart part)
方法...事实上我下载了MEF的最新源代码(C#),在找不到任何方法使用 AddPart(object attributePart)
进行签名,但 Intellisense 将我显示为 C# 项目中的扩展,这让我更加困惑...
Anybody can give simple MEF example in C++/CLI?
Best Wishes
PS:I try to convert C# examples but have diffuculties...For example
CompositionBatch^ batch = gcnew CompositionBatch();
batch->AddPart(this);
In C++/CLI i can not reach CompositionBatch
class overloaded method AddPart(object attributedPart)
of CompositionBatch
...Compiler just see AddPart(ComposablePart part)
method...In fact i downloaded the latest source of MEF(in C#),in can not find any method signature with AddPart(object attributedPart)
but Intellisense show me as an extension in a C# project which confuse me more...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
C++/CLI 不支持这种方式的扩展方法。扩展方法由编译器解析为绝对方法调用。该特定方法是 AttributedModelServices 类的扩展方法。这样称呼它:
C++/CLI doesn't support extension methods this way. Extension methods are resolved by the compiler into absolute method calls. That particular method is an extension method of the
AttributedModelServices
class. Call it as such: