How do i get MEF container to inject himself
问题 I'm using constructor injection with MEF Composition Container and I want to know how can I make the CompositionContainer inject itself on the instance of the object he is providing. 回答1: You can use one of the CompositionContainer.ComposeExportedValue methods to create a part from a given object. Here's a sample: class Program { static void Main(string[] args) { var container = new CompositionContainer(new ApplicationCatalog()); Console.WriteLine("Main: container [{0}]", container