I'm trying to reflect into an assembly and get out all of the types who derive from a generic type.
protected List<Assembly> _assemblies = new List<Assembly>();
public List<Type> FilterByType<T>()
{
return this._assemblies.SelectMany(x => x.GetTypes()).Where(type => typeof (T).IsAssignableFrom(type)).ToList();
}
However when I try to call the filter method I cannot pass a Type-Less Generic
// This does not compile because it's an unbound generic
FilterByType<AbstractValidator<>>()
How can I Filter where any of my bases are a derrive from a generic?
Aucun commentaire:
Enregistrer un commentaire