vendredi 5 juin 2015

C# list of types that extend some base type

Though trying to find what I needed among strong keywords like "Type" or "Generic" was somewhat confusing, I think it's better to ask here and maybe you guys will get my point.

Basically, what I'm trying to achieve is something similar to that Java code:

List<Class<? extends BaseType>> typeList;

It's a list of Classes (not specific objects of those classes) that must be extending some BaseType, so the list won't accept just any kind of Class object. Are there any ways to do that as easily as in Java or it's necessary to create a custom List extension and do the whole thing "manually"?

Thanks for all your advices.





Aucun commentaire:

Enregistrer un commentaire