同事写了个接口给我,但我没用过不知道怎么用。

解决方案 »

  1.   

    class myClass : IXXX
    {
    };
      

  2.   

    接口不能直接使用,它没提供具体的实现,只定义了一些方法或者属性。
    你同事估计是让你写一个类实现这个接口。方法在1楼
    class 你写的类 : 你同事的接口{    // .....实现}
      

  3.   


    interface Imyinterface
            {
                void SayHello(string str);
            }        class A : Imyinterface
            {
                #region Imyinterface 成员            public void SayHello(string str)
                {
                    MessageBox.Show("Class A SayHello Method:"+str);
                }            #endregion
            }
            class B : Imyinterface
            {
                #region Imyinterface 成员            public void SayHello(string str)
                {
                    MessageBox.Show("Class B SayHello Method:" + str); 
                }            #endregion
            }
      

  4.   


    public interface ISend
    {
    void Add();
    }public myClass:ISend
    {
    public void Add()
    {
    //你的代码
    }
    }