private IClass ok=new Class1();

解决方案 »

  1.   

    接口不是类。 不要像类那样的用。
    下面有个范例代码,您可以参看:// keyword_interface.cs
    // Interface implementation
    using System;
    interface IPoint 
    {
       // Property signatures:
       int x 
       {
          get; 
          set; 
       }   int y 
       {
          get; 
          set; 
       }
    }class MyPoint : IPoint 
    {
       // Fields:
       private int myX;
       private int myY;   // Constructor:
       public MyPoint(int x, int y) 
       {
          myX = x;
          myY = y;
       }   // Property implementation:
       public int x 
       {
          get 
          {
             return myX;
          }      set 
          {
             myX = value; 
          }
       }   public int y 
       {
          get 
          {
             return myY; 
          }
          set 
          {
             myY = value; 
          }
       }
    }class MainClass 
    {
       private static void PrintPoint(IPoint p) 
       {
          Console.WriteLine("x={0}, y={1}", p.x, p.y);
       }   public static void Main() 
       {
          MyPoint p = new MyPoint(2,3);
          Console.Write("My Point: ");
          PrintPoint(p);
       }
    }
      

  2.   

    http://www.csdn.net/develop/author/netauthor/Latitude/这里有一些相关的文章可以看看.