DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Intersect Using LINQ

05.06.2012
| 2485 views |
  • submit to reddit
        
int[] listA= { 1,2,3}; 
int[] ListB = { 1,5,6,4}; 
  
    var result = listA.Intersect(listB); 
  
    foreach (var n in result) 
    { 
        Console.WriteLine(n); 
    }