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

今天写一个类实现 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)
        {
        }
    }
}

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

原文地址:https://www.cnblogs.com/yzx99/p/3375300.html