3 回答

TA貢獻(xiàn)2051條經(jīng)驗(yàn) 獲得超10個贊
除了提問者自己的答案之外,還可能值得注意以下幾點(diǎn)。發(fā)生這種情況的原因是因?yàn)轭惪梢允褂门c接口方法具有相同簽名的方法而不實(shí)現(xiàn)該方法。以下代碼說明:
public interface IFoo
{
void DoFoo();
}
public class Foo : IFoo
{
public void DoFoo() { Console.WriteLine("This is _not_ the interface method."); }
void IFoo.DoFoo() { Console.WriteLine("This _is_ the interface method."); }
}
Foo foo = new Foo();
foo.DoFoo(); // This calls the non-interface method
IFoo foo2 = foo;
foo2.DoFoo(); // This calls the interface method

TA貢獻(xiàn)1804條經(jīng)驗(yàn) 獲得超2個贊
當(dāng)我的應(yīng)用程序沒有引用定義錯誤消息中使用的方法的類的另一個程序集時,我得到了這個。運(yùn)行PEVerify會產(chǎn)生更多有用的錯誤:“系統(tǒng)無法找到指定的文件?!?/p>
- 3 回答
- 0 關(guān)注
- 1068 瀏覽
添加回答
舉報