Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有两个清单
var items = new[] { "one", "two", "three" }; var items2 = new[] { "one" };
我想比较两个列表,得到items2中没有的项目。基本上需要如下输出
two three
尝试这个
items.Except(items2).ToList().ForEach(x=>Console.Write(x));
items.Except(items2);
会给你你预期的结果。