Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Please under stand the flow of code .
I have an interface Ishape which in some separate dll or class library.

C#
[InheritedExport]
    public interface Ishape
    {

        int Paint(int width, int height);

    }


C#



In my window application I have two classes.

C#
public class Circle : MEF_Test.Ishape
   {
       public int Paint(int width, int height)
       {

           return 0;
       }

   }
   [Export(typeof(Ishape))]
   public class Rect : MEF_Test.Ishape
   {
       public int Paint(int width, int height)
       {

           return 0;
       }

   }



I want to bind class names in combobox who inherit interface IShape .
I am new to both window application and MEF ( managed extensibilty Framework )

Please somebody help . I need it as soon as possible .

Thanks in advance
Regard
Posted

1 solution

Hi,

Just use the meta data for example:

[ExportMetadata("Name", "ControlsLibrary1.BlueControl")]

Then when you load all of the Shapes you can add them to the Combo-Box.

You can read more about it in my article:

The Simplest Way to use MEF Fully Lazy DLL Loading[^]

I hope it would help you :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900