bert

Just another Wordpress.com weblog

Except

Coding tip of the day: when you have two lists of strings and want to know the items that are in the first list, but not in the second, use IList.Except:

var firstlist = new List<string>() { "soep", "aap" };

var secondlist = new List<string>() { "soep", "koffie" };

var result = firstlist.Except(secondlist).ToList();

This code returns a list of strings with one item: “aap”

May 18, 2011 Posted by | Uncategorized | Leave a Comment

   

Follow

Get every new post delivered to your Inbox.