【发布时间】:2023-03-18 23:57:01
【问题描述】:
在给定 C# 中的两个数组的情况下,执行集合减法的最简单方法是什么?显然这是 Ruby 中的dead easy。基本上我只想从数组a 中删除数组b 中的元素:
string[] a = new string[] { "one", "two", "three", "four" };
string[] b = new string[] { "two", "four", "six" };
string[] c = a - b; // not valid
c 应该等于 { "one", "three" }。 b - a 将产生 { "six" }。
【问题讨论】:
标签: c# arrays set-operations