Note: by default, a type is used as a contract, rather than a string. Although the contract can be used as an arbitrary string, this will lead to ambiguity. For example, "sender" may be overwritten by "sender" in different class libraries of another project. Therefore, if you need to specify a string contract, we recommend that you use a namespace for the contract name, including the company name, for example, "contoso. Exports. Sender ".
According to the code above, all the export operations should be as follows:
Code segment
Namespace mefsample {[Export] public class exporter {...} [Export (typeof (exporter)] public class exporter1 {...} [Export ("mefsample. exporter ")] public class exporter2 {...}}
By default, the export feature uses the specific types of members as conventions. You can also explicitly specify the conventions by passing parameters to the feature constructor. The common mode is to allow components to explicitly export an interface or an abstract type contract, rather than a specific type. In this way, the importer can be completely decoupled from the specific implementation of the export.