I have a generic list ItemList where if each ListID doesn’t contain all possible ItemIDs, then I’d like to remove them from the list.
I’ll illustrate below with a cut down version of the data:
MaxItemID = 4
ListID ItemID
1 1
2 1
2 2
2 3
2 4
3 1
3 2
4 1
4 2
4 3
4 4
5 1
5 2
And the data I’d like out of that would be:
ListID ItemID
2 1
2 2
2 3
2 4
4 1
4 2
4 3
4 4
I asked a similar question yesterday relating just to SQL, and got an answer of using Exists, which was good, but I’ve since discovered that the maximum number of items could vary, and also I think I’d prefer to use linq. I thought using a distinct().Count() technique could work, but had no success so far, and it sounds like it’s not the most efficient way either.
Thanks very much
1 Answer