Tuesday, April 5, 2011

LINQ Intersect

I had a situation where I needed to get the intersection of two lists and found that using a simple LINQ statement made it very easy.

x.Split(",").Select(Function(x) x.Trim).Intersect(y, StringComparer.OrdinalIgnoreCase)

http://msdn.microsoft.com/en-us/library/bb460136.aspx

0 comments: