本文介绍了C# 是否有理由使用 ArrayList 而不是 List<T>不再?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

标题几乎概括了它.既然我们有了 List,为什么还有人想要使用 ArrayList 呢?我能想到的唯一原因是,在实施 List 之前,您是否被迫使用旧版本的 .NET?

The title pretty much sums it up. Now that we have List<T>'s why would anyone want to use an ArrayList instead? The only reason I can think of is if you are forced to use an old version of .NET before List<T> was implemented?

推荐答案

正如您所说,如果由于某种原因您坚持使用 .Net 1.1,那么您别无选择.

As you said, if for some reason you are stuck with .Net 1.1 then you don't have a choice.

你的问题似乎表明有一个选择.那么就没有理由使用用户ArrayList.ArrayList 能做的任何事情,List 也能做,甚至更好.

Your question seems to indicate that there is a choice. So then there is no reason to userArrayList. Anything that ArrayList can do, List<T> can do as well, if not better.

这篇关于C# 是否有理由使用 ArrayList 而不是 List&lt;T&gt;不再?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 09:30