为什么IList的< T>继承了IEnumerable< T>和IEnumerable再次 [英] Why IList<T> inherits IEnumerable<T> and IEnumerable again

查看:139
本文介绍了为什么IList的< T>继承了IEnumerable< T>和IEnumerable再次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在 一脸的IList< T> 的ICollection< ; T> 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< ; T> 继承了IEnumerable< T> 的IEnumerable ,没关系。 的IList< T> 的ICollection<继承; T> ,但为什么的IList< T> 具有继承的IEnumerable< T> 的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.

这篇关于为什么IList的&LT; T&GT;继承了IEnumerable&LT; T&GT;和IEnumerable再次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆