views:

1360

answers:

1

I'm looking for a simple code sample showing how to use Microsoft Managed Extensibility Framework (MEF).

I really like the code at http://blogs.msdn.com/brada/archive/2008/09/29/simple-introduction-to-composite-applications-with-the-managed-extensions-framework.aspx, but it was written for MEF CTP 2 or 3 and the syntax has changed for the current version (CTP5).

+1  A: 

I would just download MEF and look at the included samples.

There is a page with sample documentation on the MEF site, as well. The sample docs are a little out of date, though - the samples in the download are more current. In addition, CTP5 added a new sample (MEF Studio).

In terms of looking at code, this is probably the simplest sample to decipher. The only part missing from that file is the definition on the MainWindow class:

[Export]
public partial class MainWindow
{
    // ...

If you add that, it's pretty much a complete sample.

Reed Copsey