错误提示与实际问题不符合的案例之一

今天写一个类实现 IList 接口时,编译不成功,提示
使用泛型 类型“System.Collections.Generic.IList<T>”须要“1”个类型实参网络

开头觉得本身格式写不对,但找一下网络,结果让人大跌眼镜,竟然是:
漏了using System.Collections;这句话函数

实现该错误的代码以下:
using System;
using System.Collections.Generic;
namespace WindowsFormsApplication12
{
    public class MyCollection : System.Windows.Forms.ListBox.ObjectCollection, IList  //, IDictionary
    {
        public MyCollection(System.Windows.Forms.ListBox owner):base(owner)
        {
        }
    }
}spa

其中,若是把构造函数去掉,又会产生以下错误
“System.Windows.Forms.ListBox.ObjectCollection”不包含采用“0”参数的构造函数orm

相关文章
相关标签/搜索