int[] a = { 1, 2, 3, 4, 5, 6, 7 }; int[] b = { 4, 5, 6, 7, 8, 9, 10 }; int[] c = { 1, 2, 3, 3, 4, 1, 2, 4, 6, 1, 6, 5 }; // 交集 var ** = a.Intersect(b); 4,5,6,7 // 并集 var ** = a.Union(b); 1,2,3,4,5,6,7,8,9,10 // a有b没有的 var diff1 = a.Except(b); 1,2,3,9,10 // b有a没有的 var diff2 = b.Except(a); 8,9,10 var max = a.Max(); var min = a.Min(); var avg = a.Average(); var dis = c.Distinct();
时间: 2024-10-24 13:16:59