WYVE

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
 1         static void Main(string[] args)
 2         {
 3 
 4             Stopwatch watch = new Stopwatch();
 5             watch.Start();
 6             Console.WriteLine("Time1 = " + watch.ElapsedMilliseconds);
 7             IEnumerable<string> lsFiles = Directory.EnumerateFiles(@"D:\", "*.*", SearchOption.AllDirectories);
 8             Console.WriteLine("Time2 = " + watch.ElapsedMilliseconds);
 9             foreach (var item in lsFiles)
10             {
11 
12             }
13             Console.WriteLine("Time3 = " + watch.ElapsedMilliseconds);
14             watch.Stop();
15             watch.Restart();
16             Console.WriteLine("Time3 = " + watch.ElapsedMilliseconds);
17             watch.Stop();
18         }

 

posted on 2018-07-12 14:55  WYVE  阅读(168)  评论(0编辑  收藏  举报