Why collections classes in C# (like ArrayList) inherit from multiple interfaces if one of these interfaces inherits from the remaining?

前端 未结 6 1057
南笙
南笙 2020-12-08 07:28

When I press f12 on the ArrayList keyword to go to metadata generated from vs2008, I found that the generated class declaration as follows

public class Array         


        
6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-08 07:31

    The extra interfaces are shown because they are implied by IList. If you implement IList, you must also implement ICollection and IEnumerable.

提交回复
热议问题