ArrayList vs List<> in C#

后端 未结 12 1949
深忆病人
深忆病人 2020-11-22 04:10

What is the difference between ArrayList and List<> in C#?

Is it only that List<> has a type while ArrayLis

12条回答
  •  囚心锁ツ
    2020-11-22 05:15

    To add to the above points. Using ArrayList in 64bit operating system takes 2x memory than using in the 32bit operating system. Meanwhile, generic list List will use much low memory than the ArrayList.

    for example if we use a ArrayList of 19MB in 32-bit it would take 39MB in the 64-bit. But if you have a generic list List of 8MB in 32-bit it would take only 8.1MB in 64-bit, which is a whooping 481% difference when compared to ArrayList.

    Source: ArrayList’s vs. generic List for primitive types and 64-bits

提交回复
热议问题