I have two lists with data as following examples
var listA = new[]{ "A", "B", "C", "D", "B", "E", "C", "F", "G"};
var listB = new[]{ "A", "B", "C", "E" };
listA can have duplicate values.
I need to find all items from listB which have unique values (non-duplicate only) in listA with LINQ or C#.
the expected result listC should be like
listC = {A, E};
I am using the following code
var list = listA.GroupBy(x => x).All(g => g.Count() == 1);
var listC = list.Except(listB).ToList();