C# Get non duplicates in a list
c#
Solution
One way would be
var singles = numbers.GroupBy(n => n)
.Where(g => g.Count() == 1)
.Select(g => g.Key); // add .ToArray() etc as required
Problem
With a list like so: ``` int[] numbers = {1,2,2,3,3,4,4,5}; ``` I can remove the duplicates using the Distinct() function so the list will read: 1,2,3,4,5 however, I want the inverse. I want it to remove all of the numbers that are duplicated leaving me with the unique ones. So the list will read: 1,5. How would this be done?