Intersect a collection of collections in LINQ

Posted by Larsenal on Stack Overflow See other posts from Stack Overflow or by Larsenal
Published on 2010-03-28T05:30:26Z Indexed on 2010/03/28 5:33 UTC
Read the original article Hit count: 361

Filed under:

I've got a list of lists which I want to intersect:

List<List<int>> input = new List<List<int>>();
input.Add(new List<int>() { 1, 2, 4, 5, 8 });
input.Add(new List<int>() { 3, 4, 5 });
input.Add(new List<int>() { 1, 4, 5, 6 });

Output should be

{ 4, 5 }

How can this be accomplished in a terse fashion?

© Stack Overflow or respective owner

Related posts about LINQ