65.9K
CodeProject is changing. Read more.
Home

Diff two lists

starIconstarIconstarIconstarIconstarIcon

5.00/5 (1 vote)

Dec 21, 2010

CPOL
viewsIcon

4653

How about using Linq to find the common items in a list?List listOne = new List{"a", "b", "c", "d"};List listTwo = new List { "d", "e", "f", "g" };List listCommon= listOne.Intersect(listTwo).ToList();

How about using Linq to find the common items in a list?
List<String> listOne = new List<string>{"a", "b", "c", "d"};
List<String> listTwo = new List<string> { "d", "e", "f", "g" };
List<String> listCommon= listOne.Intersect(listTwo).ToList();