var container = new CompositionContainer(); container.InitializeAll(typeof(MyAssembly).Assembly);
var catalog = new AssemblyCatalog(typeof(MyAssembly).Assembly); var container = new CompositionContainer(catalog); container.InitializeAll();This example first creates an AssemblyCatalog object that represents the assembly "MyAssembly". Then, it creates a CompositionContainer object that uses the created catalog. Finally, it calls the InitializeAll method on the container, which initializes all the exported parts in the assembly. Package library: The CompositionContainer class is a part of the System.ComponentModel.Composition namespace, which is included in the .NET Framework Class Library.