I am able to return a grouped list of items from my collection using the following code:
var items = collection.SelectMany(myObj => myObj.ToNames)
.GroupBy(name => name)
.Select(g => new { Name = g.Key, Count = g.Count() });
The above code gives me a nice list of unique names and the number of times they were found in the collection. I now have a need to do the same thing, but group the Names from two seperate collections found in the same MyObj. I now want to group myObj.ToNames and myObj.FromNames in the same manner – along with getting the overall unique count for each unique name found (no matter which collection it was found in).
Is this possible?
Union:
Concat: