为什么IList被定义成这样?
所以,为了测试,我创建了这些接口,只是为了确定是否有效!
public interface IList<T> : ICollection<T>, IEnumerable<T>, IEnumerable
public interface ICollection<T> : IEnumerable<T>, IEnumerable
public interface IEnumerable<T> : IEnumerable
难道它不可能只是
public interface IList<T> : ICollection<T>
所以,为了测试,我创建了这些接口,只是为了确定是否有效!
public interface IOne
{
string One();
}
public interface ITwo : IOne
{
string Two();
}
public interface IThree : ITwo, IOne
{
string Three();
}
虽然这是完全可以接受的,但Resharper会抱怨“冗余接口”。
微软为什么要采用这种实现方式?有任何想法吗?
IList <T>
。它显示了来自程序集元数据
的方法签名
,我从那里就可以看到了。 - now he who must not be named.IList<T>
的基接口列表中不包括IEnumerable<T>
或IEnumerable
。同样,ICollection<T>
也不包括IEnumerable
。 - user4003407