Tag: array intersect

快速count()两个字符串数组的交集

我需要计算对应于两个大字符串数组的交集的元素数量,并且非常快。 我使用以下代码: arr1[i].Intersect(arr2[j]).Count() 对于CPU时间,VS Profiler指示 System.Linq.Enumerable.Count() 85.1% System.Linq.Enumerable.Intersect() 0.3% 不幸的是,完成所有工作可能需要数小时。 怎么做得更快?