Tag: set operations

如何在C#中对数组执行set减法?

给定C#中的两个数组,执行set减法的最简单方法是什么? 显然,这在Ruby中很容易实现。 基本上我只想删除数组b中的数组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” } 。