上代码:
var numbers = new int[]{ 1, 2,4,4,6,8,8 }; var result = from n in numbers group n by n into g where g.Count() == 1 select g.Key;
老大!你真犀利!顶一下!
List<int> _list = new List<int>(); int[] _intNum={1,2,4,4,6,8,8}; _list.AddRange(_intNum); var _queryDay = _list.AsEnumerable().GroupBy(x=>x).Where(x => x.Count() == 1).Select(x => x.Key); _queryDay.ToList().ForEach(x => { Console.WriteLine(x); });