[C#]MEF開發系列 - Managed Extensibility Framework(MEF)的概念與簡介
public MainForm()
{
InitializeComponent();
var catalog = new DirectoryCatalog(Environment.CurrentDirectory, "*.dll");
var container = new CompositionContainer(catalog);
container.ComposeParts(this);
foreach (IModule module in Modules)
{
module.Host = this;
模組MToolStripMenuItem.DropDownItems.Add(module.Name, null, Module_Click).Tag = module;
}
}
...
} }