Why ArrayList implement IList, ICollection, IEnumerable?

前端 未结 4 561
栀梦
栀梦 2020-12-20 11:59

ArrayList declares that it implements the IList, ICollection, and IEnumeralbe interfaces.

Why not only implement

4条回答
  •  情书的邮戳
    2020-12-20 12:33

    1. IEnumerable - To support the foreach statement
    2. ICollection - To support add single or multiple item in arraylist

提交回复
热议问题