我有两个列表
var items = new[] { "one", "two", "three" };
var items2 = new[] { "one" };
我想比较两个列表并获取items2中不可用的项目。基本上需要以下输出
two three
答案 0 :(得分:2)
试试这个
items.Except(items2).ToList().ForEach(x=>Console.Write(x));
答案 1 :(得分:2)
items.Except(items2);
会给你预期的结果。