【发布时间】:2010-06-17 02:11:52
【问题描述】:
可能重复:
Detect if a method was overridden using Reflection (C#)
有没有办法判断一个方法是否是覆盖?例如
public class Foo
{
public virtual void DoSomething() {}
public virtual int GimmeIntPleez() { return 0; }
}
public class BabyFoo: Foo
{
public override int GimmeIntPleez() { return -1; }
}
是否可以反映 BabyFoo 并判断 GimmeIntPleez 是否是覆盖?
【问题讨论】:
-
太棒了!非常感谢,佩塔尔。你如何找到这样的线程?
-
@Rowland:在执行(又名运行时)时。在编译时,我可以在源文件上使用正则表达式,如果那是你所暗示的。
-
使用 StackOverflow 上的搜索功能(右上角) - “C# 方法覆盖”足以找到线程。你也可以使用谷歌:)
标签: c# reflection oop system.reflection