错误 1 “ConsoleApplication7.ShortCollection<T>”不会实现接口成员“System.Collections.Generic.IList<T>.IndexOf(T)”
是怎么会事啊
我已经做了一个函数如下:
 public int Indexof(T item)
        {
            return (innerCollection as IList<T>).IndexOf(item);
        }
怎么它还是提示:不会实现接口成员啊请大家帮忙谢谢!

解决方案 »

  1.   

    接口里面返回类型应该也是范型吧 你这里定为int了
      

  2.   

    谢谢楼上回答
    但是IndexOf 的返回值是int的啊
      

  3.   

    而且奇怪的是其他的方法采用同样的方式又没问题,比如
    public void RemoveAt(int index)
            {
                (innerCollection as IList<T>).RemoveAt(index);
            }
    请大家帮忙了
      

  4.   

    public int Indexof(T item)
            {
                return (innerCollection as IList<T>).IndexOf(item);
            }是否应该改为 public int Indexof<T>(T item)
            {
                return (innerCollection as IList<T>).IndexOf(item);
            }ps:不怎么懂范型