为什么IList的< T>继承了IEnumerable< T>和IEnumerable再次

为什么IList的< T>继承了IEnumerable< T>和IEnumerable再次

问题描述:

我已经在 一脸的IList&LT; T&GT; 的ICollection&LT ; T&GT; MSDN上偶然的机会,看到这两个接口的定义是:

I have taken a look on IList<T> and ICollection<T> on MSDN by chance, and see that the definition of these two interfaces are:

public interface ICollection<T> : IEnumerable<T>, IEnumerable
public interface IList<T> : ICollection<T>, IEnumerable<T>, IEnumerable



注意的ICollection&LT ; T&GT; 继承了IEnumerable&LT; T&GT; 的IEnumerable ,没关系。 的IList&LT; T&GT; 的ICollection&LT继承; T&GT; ,但为什么的IList&LT; T&GT; 具有继承的IEnumerable&LT; T&GT; 的IEnumerable 再次

Notice that ICollection<T> inherits from IEnumerable<T> and IEnumerable, that's okay. IList<T> inherits from ICollection<T>, but why IList<T> has to inherit IEnumerable<T> and IEnumerable again?

任何有没有道理呢?

的文档生成方式,所以你可以看到连接的一个类型实现,而不必遵循通过接口继承传递链接层次结构。

The documentation is generated that way so you can see what interfaces a type implements without having to follow transitive links through the interface inheritance hierarchy.