How to find common elements from multiple List using Linq in C#

02 Apr 2014, 09:11 AM

Use Intersect method to find the common elements form the two lists. See example below to

List<string> list1 = new List<string>(); 
List<string> list2 = new List<string>(); 

list1.Add("1"); 
list1.Add("3"); 
list1.Add("5"); 

list2.Add("3");
list2.Add("4"); 
list2.Add("5");

var commonList = list1.Intersect(list2);

Related Contents

15 May 2014, 08:07 AM
C#, LINQ, List
15 May 2014, 07:54 AM
C#, LINQ, List
29 Apr 2014, 03:07 AM
C#, Generic
About
Explains how to get common elements from multiple list using Linq in c#

Date Posted 02 Apr 2014, 09:04 AM
Author Brainy Solutions
Views 3,019
;