Given the following example class:
class Foo<T>
{
void Bar<S>(T inputT, S inputS)
{
// Some really magical stuff here!
}
}
If I am reflecting against method Foo<>.Bar<>(...)
, and examining the parameter types, say:
var argType1 = typeof(Foo<>).GetMethod("Bar").GetParameters()[0].ParameterType;
var argType2 = typeof(Foo<>).GetMethod("Bar").GetParameters()[1].ParameterType;
both argType1
and argType2
look similar:
FullName
property is nullName
property is "T" or "S" respectivelyIsGenericParameter
is true
Is there anything in the parameter type information that allows me to distinguish that the first argument is defined at the type-level, while the second argument is a method-level type parameter?
Aucun commentaire:
Enregistrer un commentaire