代码
Stopwatch watch = new Stopwatch();
watch.Start();
ArrayList al
= new ArrayList();
for (long i = 0; i < 1000000; i++)
{
al.Add(i);
}
watch.Stop();
Console.WriteLine(watch.ElapsedMilliseconds);

watch.Reset();

watch.Start();
List
<int> list = new List<int>();
for (int i = 0; i < 1000000; i++)
{
list.Add(i);
}
watch.Stop();
Console.WriteLine(watch.ElapsedMilliseconds);

 

相关文章:

  • 2021-05-18
  • 2022-02-28
  • 2022-01-08
  • 2021-07-16
  • 2021-06-13
  • 2021-12-26
  • 2021-11-15
猜你喜欢
  • 2022-12-23
  • 2021-08-13
  • 2022-12-23
  • 2021-12-27
  • 2022-12-23
相关资源
相似解决方案