设为首页 加入收藏

TOP

两个集合对比(二)
2019-10-09 20:04:53 】 浏览:299
Tags:两个 集合 对比
-------
"); 30 Console.WriteLine("-------------------listA中交集外---------------------"); 31 watch = new Stopwatch(); 32 watch.Start(); 33 var listD = listA.Except(listA.Intersect(listB)); 34 watch.Stop(); 35 span = watch.Elapsed; 36 Console.WriteLine("listA中交集外 总共花费{0}ms.", span.TotalMilliseconds); 37 foreach (var item in listD) 38 { 39 Console.WriteLine(item); 40 } 41 Console.WriteLine("----------------------listB中交集外--------------------"); 42 watch = new Stopwatch(); 43 watch.Start(); 44 var listE = listB.Except(listA.Intersect(listB)); 45 watch.Stop(); 46 span = watch.Elapsed; 47 Console.WriteLine("listB中交集外 总共花费{0}ms.", span.TotalMilliseconds); 48 foreach (var item in listE) 49 { 50 Console.WriteLine(item); 51 } 52 Console.WriteLine("--------------listA和listB中交集外-------------------"); 53 watch = new Stopwatch(); 54 watch.Start(); 55 var listF = listA.Concat(listB).Except(listA.Intersect(listB)); 56 watch.Stop(); 57 span = watch.Elapsed; 58 Console.WriteLine("listA和listB中交集外 总共花费{0}ms.", span.TotalMilliseconds); 59 foreach (var item in listF) 60 { 61 Console.WriteLine(item); 62 } 63 #endregion 64 }

对比的运行时长结果:

我的配置是:

 

首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Winform中设置ZedGraph鼠标双击获.. 下一篇完美实现保存和加载easyui datagr..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目