Consider the following two types:
public abstract class Abase {
}
public class MyGeneric<T> : Abase {
}
If I create a Type at runtime using MakeGenericType:
How can I query the assembly or namespace later for that type?
var paramType = typeof (string);
var myMiscType = typeof (MyGeneric<>).MakeGenericType(paramType);
var assembly = myMiscType.Assembly;
//my type is not in here:
var allTypesfromMyTypeAssembly = (
from t in assembly.GetTypes()where typeof (Abase).IsAssignableFrom(t)select t);
I tried a few things, but none seem to work. Is what I want Possible?
Aucun commentaire:
Enregistrer un commentaire