If I have a MethodInfo on a closed generic Type is there an easy way to switch those types?

前端 未结 4 1459
醉酒成梦
醉酒成梦 2020-12-06 12:26

Let\'s say that I have the methodInfo for something like Nullable.HasValue. Is there anyway to convert it to Nullable.HasValue

4条回答
  •  执笔经年
    2020-12-06 13:07

    You have to reflect again because the methods are different. While the only difference for HasValue is the MethodInfo.DeclaringType, the difference in the Value property is the MethodInfo.ReturnType.

提交回复
热议问题