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”

Advertisement

May 18, 2011 - Posted by | Uncategorized

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.