C# Addin framework, MEF Example (Managed Extensibility Framework)
Example of using MEF to dynamically load calculator object. Create .Net 4.0 solution with the following projects (MEFExample is Console others are Libraries) Add Reference to System.ComponentModel.Composition to Library projects. public interface ICalculator { string Name { get ; } int Calculate( int a, int b); } public class CalculatorManager { [ImportMany( typeof (ICalculator))] private IEnumerable<ICalculator> _calculators; public IEnumerable<ICalculator> GetCalculators() { var catalog = new AggregateCatalog(); catalog.Catalogs.Add( new DirectoryCatalog(@" .\extensions\ ")); var container = new CompositionContainer(catalog); container.ComposeParts( this ); Console.WriteLine(" Found {0} Calculators ", _calculators.Count()); return _calculators; } } [Export( typeof (ICalculator))] public class CalculatorAdd : ICalculator { publi...