Advertisement
Guest User

Hosting MEF in an application

a guest
Jan 30th, 2011
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.57 KB | None | 0 0
  1.   // From http://mef.codeplex.com/wikipage?title=Hosting%20MEF%20and%20the%20Container&referringTitle=Guide
  2.   using System.ComponentModel.Composition;
  3.   using System.ComponentModel.Composition.Hosting;
  4.   using System.Reflection;
  5.   using System;
  6.  
  7.   public class Program
  8.   {
  9.     public static void Main(string[] args)
  10.     {
  11.       Program p = new Program();
  12.       p.Run();
  13.     }
  14.  
  15.     public void Run()
  16.     {
  17.       Compose();
  18.     }
  19.  
  20.     private void Compose()
  21.     {
  22.       var container = new CompositionContainer();
  23.       container.ComposeParts(this);
  24.     }
  25.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement