dynamically build Intersect statement ASP.NET

Posted by TDDG on Stack Overflow See other posts from Stack Overflow or by TDDG
Published on 2010-06-02T20:40:28Z Indexed on 2010/06/02 20:44 UTC
Read the original article Hit count: 151

Filed under:

I would like to use the IEnumerable function Intersect() to combine a few list and get the similar integers from each list. The problem I'm faced with is that I don't know how many list I will need to compare.

Here is an example:

A{1,2,3,4} B{1,2,3} C{1,2}

results = A.Intersect(B).Intersect(C)

This works great, but the next time around I may have a D{1,2} next time I come across the function.

I'd like to use the Intersect method, but I'm open to new ideas as well.

© Stack Overflow or respective owner

Related posts about ASP.NET