Click here to Skip to main content
11,581,397 members (64,076 online)
Click here to Skip to main content

Tagged as

Diff two lists

, 19 Dec 2010 CPOL 2.1K 2
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 --
| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150603.1 | Last Updated 19 Dec 2010
Article Copyright 2010 by Chris Hey
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid