.NET: ArrayList vs List

后端 未结 5 1539
别跟我提以往
别跟我提以往 2020-12-08 19:25

What is the difference between ArrayList and List in VB.NET

5条回答
  •  一向
    一向 (楼主)
    2020-12-08 19:38

    List is a generic implementation of ArrayList. ArrayList stores all objects as System.Object which you need then cast to appropriate type. ArrayLists are heterogenous, List can store only one type of objects - that type supplied as its generic parameter.

    List strList; // can store only strings
    List intList; // can store only ints
    ArrayList someList; // can store anything
    

提交回复
热议问题