locked
Doing .NET MEF in Visual C# 2010 Express: Composable Parts-Contracts, Interface/Abstract Contracts, & Contract Assemblies: What is public class Notifier { [ImportMany]...}? RRS feed

  • General discussion

  • Hi all,

    I managed to complete "Microsoft .NET MEF:  Hosting MEF in an Application" tutorial successfully. I tried to do the second tutorial "Microsoft .NET MEF: Contracts, Interface/Abstract Contracts, & Contract Assemblies" with difficulties.  I do not know how to use the following C# code in my Visual C# 2010 Express:

    public class Notifier {
        [ImportMany]
        public IEnumerable<IMessageSender> Senders {get; set;}
        public void Notify(string message) {
          foreach(IMessageSender sender in Senders) 
            sender.Send(message);
        } 
      }

    I don't know how to use this set of code that is associted with what related "Import" or "Export" parts!!??  

     Please help and advise me how to use this set code with the other codes in the 2 above-mentioned "Microsoft .NET MEF" tutorials as much as you can.

    Thanks,

    Scott Chang


    Thursday, July 5, 2012 7:54 PM