积极答复者
为什么静态方法不能实现接口

问题
-
class Program
{
public static string strTest = "OK!";
static object _t = new object();
static void Main(string[] args)
{
A.Hello();
Console.ReadKey();
}
}
public interface IA
{
void Hello();
}
public class A : IA
{
#region IA 成员
public static void Hello()
{
Console.WriteLine("OK");
}
#endregion
}
无
答案
全部回复
-
如果是静态方法 所有实例都可以通过类来访问的 static 可以参考这里 http://msdn.microsoft.com/zh-cn/library/79b3xss3(VS.80).aspx
Wenn ich dich hab’,gibt es nichts, was unerträglich ist.坚持不懈!My blog~~~