我有一个书籍收藏课。我有一个我想使用的删除方法,那是在我添加书籍之后。这是我的书:
myList<Book> lst = new myList<Book>();
lst.addItem(new Book("Dumas", "Alexandre", "The Count Of Monte Cristo", 1844));
lst.addItem(new Book ("Clark", "Arthur C", "Rendezvous with Rama", 1972 ));
lst.addItem(new Book("Dumas", "Alexandre", "The Three Musketeers", 1844)); ;
lst.addItem((new Book ("Defoe", "Daniel", "Robinson Cruise", 1719)));
lst.addItem(new Book ("Clark", "Arthur C", "2001: A space Odyssey", 1968 ));
我的删除方法如下所示:
public void removeItem(T item)
{
Array.Resize(ref items, items.Count() -2);
}
因此,如果我想从列表中删除例如第一本书,我尝试这样做:
lst.removeItem(0);
但是我收到一条错误消息,说“方法'removeItem'没有重载需要0个参数”
我做错了什么?