I have a generics class, that uses TBase as the type parameter. Using MEF, I wanted a list of Generic Type that it should Import. I tried to use this :
1)
[ImportMany(typeof(TBase))]
public List<TBase> ObjectList { get; set; }
2)
Type IValueType = typeof(TBase)
[ImportMany(IValueType)]
public List<TBase> ObjectList{ get; set; }
3)
[ImportMany(TBase)]
public List<TBase> ObjectList{ get; set; }
The first Shows
{'TBase': an attribute argument cannot use type parameters
}
The second Shows
{An object reference is required for the non-static field, method, or property
}
The third Shows
{'TBase' is a 'type parameter' but is used like a 'variable'
}
What am I Doing wrong here? How can I Fix it?