3 回答

TA貢獻(xiàn)2051條經(jīng)驗(yàn) 獲得超10個(gè)贊
除了提問(wèn)者自己的答案之外,還可能值得注意以下幾點(diǎn)。發(fā)生這種情況的原因是因?yàn)轭?lèi)可以使用與接口方法具有相同簽名的方法而不實(shí)現(xiàn)該方法。以下代碼說(shuō)明:
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個(gè)贊
當(dāng)我的應(yīng)用程序沒(méi)有引用定義錯(cuò)誤消息中使用的方法的類(lèi)的另一個(gè)程序集時(shí),我得到了這個(gè)。運(yùn)行PEVerify會(huì)產(chǎn)生更多有用的錯(cuò)誤:“系統(tǒng)無(wú)法找到指定的文件?!?/p>
- 3 回答
- 0 關(guān)注
- 1060 瀏覽
添加回答
舉報(bào)