So, let's say I have class
public class Sample<T>
{
// (1)
public static void StaticMethod1() {
}
// (2)
public static T2 StaticMethod2<T2>() where T2 : new() {
return new T2();
}
// (3)
public void InstanceMethod1() {
}
// (4)
public T2 InstanceMethod2<T2>() where T2: new () {
return new T2();
}
}
And I want to get methods with concrete generic arguments:
- T
- T, T2
- T
- T, T2
So, for now, I know how to get what I need only for third method GetType().GetMethod("InstanceMethod1)
since GetType
returns type with generic arguments (but cannot be called in static context), but how to do it in other cases? Is there any way at all?
Aucun commentaire:
Enregistrer un commentaire