CSharp中的集合接口,类之间的关系

C#

今天看到了一句话
the Where() LINQ extension method is used to filter for a particular set of URLs. Where(), like most LINQ methods, returns an IEnumerable value
让我好奇IEnumerable Icollection Ilist list之间到底是什么关系
顺带IEnumerable可以直接调用ToList变成list

LINQ

C#

1 All LINQ queries must start with the ‘var’ keyword. In fact, the very purpose of the ‘var’ keyword is to start a LINQ query!

1
2
3
4
5
6
string[] people = new [] { "Tom", "Dick", "Harry" };
var filteredPeople = people.Where (p => p.Length > 3);
//is precisely equivalent to:

string[] people = new [] { "Tom", "Dick", "Harry" };
IEnumerable<string> filteredPeople = people.Where (p => p.Length > 3);