0

I'll explain the question with an example.

The C# predefined interface IList<T> inherits ICollection<T>, IEnumerable<T> & IEnumerable.

The C# predeined interface ICollection<T> inherits IEnumerable<T> & IEnumerable.

Given the above statements, my question is, why are the interfaces IEnumerable<T> & IEnumerable being explicitly inherited in IList<T> becuase they are already being inherited in ICollection<T>.

In essence, wouldn't the below suffice?

public interface IList<T> : ICollection<T> { //code } public interface ICollection<T> : IEnumerable<T>, IEnumerable { //code }

I want to know why have the interfaces been inherited explicitly while they were inherited as a part of other interface.

Ankit
  • 672
  • 6
  • 18
  • because it's clearer and you don't have to know or check if `ICollection` inherits `IEnumerable`? – Noctis Apr 19 '16 at 09:00
  • 1
    Also, see source code: http://referencesource.microsoft.com/#mscorlib/system/collections/generic/ilist.cs,b19f71a84062554b – Dennis Apr 19 '16 at 09:03

0 Answers0