I have an existing table and a new table.
The tables contain at least two items that need to be checked.
I need to do the following items
1) Get a list of items that are not in the new table but are in the existing table. – So they can be removed
2) Get a list of items that are in the new table but not in the existing table – So they can be added
3) Get a list of items that are in both tables but the existing table needs updateing
Here is the data
var existingItems = new[]
{
new RetryItem { CellId = 1, Content = "Bob" },
new RetryItem { CellId = 2, Content = "Bill" },
new RetryItem { CellId = 3, Content = "Frank" },
new RetryItem { CellId = 4, Content = "Tom" },
new RetryItem { CellId = 5, Content = "Dick" },
new RetryItem { CellId = 6, Content = "Harry" },
};
var newItemsLarger = new[]
{
new RetryItem { CellId = 1, Content = "Bob" },
new RetryItem { CellId = 2, Content = "Bill" },
new RetryItem { CellId = 3, Content = "Frank" },
new RetryItem { CellId = 4, Content = "Tom now Thoams" },
new RetryItem { CellId = 5, Content = "Dick now Dicky" },
new RetryItem { CellId = 6, Content = "Harry Now Harriet" },
new RetryItem { CellId = 7, Content = "Mary" },
new RetryItem { CellId = 8, Content = "Mungo" },
new RetryItem { CellId = 9, Content = "Midge" },
};
You can use the following sample program in a console application: