dimanche 25 mars 2018

ExportFactory

I'm using MEF, and this is the class member into which I compose the MEF dlls:

IEnumerable<ExportFactory<ITask,IMetaData>> myTasks

I need to discover what is the derived type of each myTasks element. That means that if I loaded a MEF dll which contains a class called Task1 that implements ITask, I want to get the type of Task1.

IEnumerable<ExportFactory<ITask,IMetaData>> myTasks; //lets assume I composed all the MEF components in here
foreach (var task in myTasks)
{
    //here I want to get somethink LIKE:
    task.innerType.Name -> should return Task1
}

Problem is I can't figure out how to get the 'real' type. Can anyone assist?

Thanks





Aucun commentaire:

Enregistrer un commentaire