【发布时间】:2012-01-01 20:05:30
【问题描述】:
我如何实现从一个类扩展为接口的方法?
我有这个接口:
public Interface myInterface
{
public static int myMethod();
}
还有这个类:
public class MyClass : myInterface
{
// And I want here to implement the method form myInterface and i don't know how
}
【问题讨论】:
-
接口不能有静态方法。
-
您需要删除接口中 myMethod 声明上的 public 和 static 修饰符。