錯誤提示與實際問題不符合的案例之一

今天寫一個類實現 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

相關文章
相關標籤/搜索