更新:2007 年 11 月
错误消息
“type name”不实现接口成员“member name”。“method name”无法实现接口成员,因为它不是公共的。
实现接口成员的方法必须具有公共可访问性。所有接口成员均为 public。
更正此错误
- 向该方法添加 public 访问修饰符。
示例
下面的代码生成 CS0737:
// cs0737.cs
interface ITest
{
int Return42();
// Try the following line instead.
// public int Return42();
}
struct Struct1 : ITest // CS0737
{
int Return42() { return (42); }
}
public class Test
{
public static int Main(string[] args)
{
Struct1 s1 = new Struct1();
return (1);
}
}