【发布时间】:2010-09-30 00:19:29
【问题描述】:
可能重复:
What is the difference between List (of T) and Collection(of T)?
何时使用一种与另一种的最佳做法是什么?
两者都实现了 IList
【问题讨论】:
-
ach.. 我在问之前搜索了这个主题,但没有找到重复项。谢谢马克!
标签: .net list collections generics
可能重复:
What is the difference between List (of T) and Collection(of T)?
何时使用一种与另一种的最佳做法是什么?
两者都实现了 IList
【问题讨论】:
标签: .net list collections generics
Collection<T>:
为泛型提供基类 收藏。
List<T>:
表示一个强类型列表 可以通过索引访问的对象。 提供搜索、排序和 操作列表。
因此,根据文档,一个旨在作为集合的基类。另一个用作容器。
所以使用List<T>和继承来自Collection<T>。
【讨论】: