Click here to Skip to main content
12,824,787 members (40,107 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


2 bookmarked
Posted 14 Dec 2010

Diff two lists

, 19 Dec 2010 CPOL
Rate this:
Please Sign up or sign in to vote.
public static class ListHelper{ public static List GetUpdatedList(this List oldList, List newList) where T : class { List itemsToAdd = new List(); List itemsToRemove = new List(oldList); foreach (var item in newList) { if...
public static class ListHelper
public static List<t> GetUpdatedList<t>(this List<t> oldList,
List<t> newList) where T : class
List<t> itemsToAdd = new List<t>();
List<t> itemsToRemove = new List<t>(oldList);
foreach (var item in newList)
if (oldList.Exists(t=&gt;t==item))
return itemsToAdd.Concat(itemsToRemove).ToList();


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Chris Hey
United Kingdom United Kingdom
No Biography provided

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170308.1 | Last Updated 19 Dec 2010
Article Copyright 2010 by Chris Hey
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid