如何实现以下目标?
输入列表:A、A、B、B、B、C、D、E、E、F
期望输出列表:C,D,F
你可以使用group by和take只包含一个元素的组:
var input = new string[] {"A","A","B","B","B","C","D","E","E","F"};
var result = input.GroupBy(x => x).Where(x => x.Count() == 1).Select(x => x.Key).ToList();
在线演示:https://dotnetfiddle.net/j2vraK