简体   繁体   中英

Simple MEF example in C++ / CLI

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...

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:

AttributedModelServices::AddPart(batch, this);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM