我需要一个快速的速度处理我的页面。要添加的值的计数将是动态的。
以上哪一项是首选的?有正当理由的支持。
编辑:例如:
string str = "a,b,c"; //Count of the number of elements in str is not fixed
string[] arr = str.Split(',');
或,
ArrayList al = new ArrayList();
al.Add(str.Split(','));
发布于 2012-05-30 19:43:21
List <T>
总是比arrayList快。List <T>'s
不必对添加到其中的值进行装箱。
ArrayList
只“接受”对象,这意味着虽然你可以将任何你想要的对象添加到列表中,但它必须被装箱(由CLR隐式地),然后当你需要这些值时,它必须再次被取消装箱(由你显式地)。
https://stackoverflow.com/questions/10815565
复制相似问题