Reputation: 3
example array:
int[] s new = {1,2,3,1};
if use:
int[] inew = snew.Distinct().ToArray();
then out put:
{1,2,3}
but I want out put:
{2,3}
Upvotes: 0
Views: 49
Reputation: 10818
You need to select everything where duplicate count is == 1:
snew.GroupBy(x => x)
.Where(x => x.Count() == 1)
.Select(x => x.First())
.ToArray();
Fiddle here
Upvotes: 3