What's the difference between IList and ICollection?
有人能详细描述一下我和我的回忆吗?而且,我们何时何地使用iList或iCollection
- 请参见:iList vs iCollection vs Collection中的答案
- @所以,这不是重复,或者我们应该标记/关闭为重复?
ICollection和IEnumerable另外,它还提供了添加和清除元素的方法和清理收集的方法。它还提供了处理元素在收集中的定位的方法。It also provides an object indexer to allow the user to access the collection with square brackets like:
MGX1〔0〕
Reference:Claudio Bernasconi's article about Ilist and IColection
- 这让人困惑;你在实质上说,ilist是一个随机顺序的集合,然后用ilist处理有序的事物。
- 谢谢塞巴斯蒂安506563,答案是美丽的:)
- 然后记得做标记
- 当然可以,塞巴斯蒂安506563
- @Sehnsucht随机顺序=1,2,4,0,6,11,非随机顺序=0,1,2,4,6,11,抱歉我不流利
- 两者都有.Count。而.Add和.Remove来自IList。IList是有序的,可以通过索引访问,而ICollection不是。IList扩展ICollection。所以几乎所有的事情都与你的答案相反??
- 马马丁,你说得对。2015年,我在英语和C语言方面没有足够的经验来正确回答这个问题。我把一切都修好了。对不起的