Given a list...
class Item
{
public Name
{
get;
set;
}
}
List<Item> items = new List<Item>
{
new Item() { Name = "Item 1" },
new Item() { Name = "Item 1" },
new Item() { Name = "Item 2" },
new Item() { Name = "Item 3" }
}
List<Item> listing = new List<Item>
{
new Item() { Name = "Item 1" },
new Item() { Name = "Item 2" },
new Item() { Name = "Item 3" }
new Item() { Name = "Item 4" }
}
etc.
I need to create a third array that will cancel out double instances between the two; however items with "Name 1" are both the same, but different 'instances'. So the third List should have 1 instance of Item 1, since 'items' had 2 instances. Any ideas of how this can be done through Linq?