【发布时间】:2013-05-19 03:24:38
【问题描述】:
在尝试比较两个 dll 的 API 更改时,一位同事注意到某些类有两个 GetType() 方法。
经过更深入的检查,原来System.Exception shadows GetType():
// this method is required so Object.GetType is not made virtual by the compiler
public new Type GetType()
{
return base.GetType();
}
我看到 System.Exception 实现了 _Exception,但我看不出为什么 GetType 必须被显式隐藏,因为它无论如何都不是虚拟的。
那么为什么 System.Exception 会影响 GetType()?
【问题讨论】:
标签: c# .net reflection gettype