本文介绍了c# 什么时候应该使用List,什么时候应该使用arraylist?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如标题所说,我什么时候应该使用List,什么时候应该使用ArrayList?

As the title says when should I use List and when should I use ArrayList?

谢谢

推荐答案

主要使用ArrayList的时间在.NET 1.1

The main time to use ArrayList is in .NET 1.1

除此之外,List 一直到(对于您本地的 T)...

Other than that, List<T> all the way (for your local T)...

对于那些(罕见的)你不知道类型(并且不能使用泛型)的情况,即使 ListArrayList(海事组织).

For those (rare) cases where you don't know the type up-front (and can't use generics), even List<object> is more helpful than ArrayList (IMO).

这篇关于c# 什么时候应该使用List,什么时候应该使用arraylist?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-27 14:38
查看更多