Sub Main() Dim a As Integer() = {1, 2, 3, 4, 5, 6, 7} Dim b As Integer() = {4, 5, 6, 7, 8, 9, 10} Dim c As Integer() = {1, 2, 3, 3, 4, 1, 2, 4, 6, 1, 6, 5} ‘ 交集 Dim fuck = a.Intersect(b) ‘ 并集 Dim shit = a.Union(b) ‘ a有b没有的 Dim diff1 = a.Except(b) ‘ b有a没有的 Dim diff2 = b.Except(a) Dim max = a.Max() Dim min = a.Min() Dim avg = a.Average() Dim dis = c.Distinct() Print(fuck) Print(shit) Print(diff1) Print(diff2) Console.WriteLine(max) Console.WriteLine(min) Console.WriteLine(avg) Print(dis) Console.ReadKey() End Sub Private Sub Print(list As IEnumerable(Of Integer)) For Each item In list Console.Write(Convert.ToString(item) & " ") Next Console.WriteLine() End Sub
时间: 2024-11-10 10:33:15