編譯器錯誤 CS0762
更新:2007 年 11 月
錯誤訊息
無法從方法 'method' 建立委派,因為它是無實作宣告的部分方法
部分方法不需要有實作宣告。然而,委派 (Delegate) 的封裝方法則需要有實作 (Implementation)。
若要更正這個錯誤
- 提供用來初始化委派之方法的實作。
範例
public delegate void TestDel();
public partial class C
{
partial void Part();
public static int Main()
{
C c = new C();
TestDel td = new TestDel(c.Part); // CS0762
return 1;
}
}