How many items are you likely to have for any combination of ItemNumber / PubCode? If the answer is "small enough," I will start with Lookup<ItemNumberPubCode, Value> (or Dictionary<ItemNumberPubCode, List<Value>> ), so if you are asked to find only two of them, you can get right in all matches. If you are asked to look at all three, you quickly get all matches of the first two, and then do an O (n) scan for any match using SizeCode.
(Here ItemNumberPubCode is a type that encapsulates ItemNumber and PubCode , it can be an anonymous type, Tuple<string, string> or a real type.)
If there can be many matches for a particular combination of ItemNumber / PubCode, then you may need Dictionary<ItemNumberPubCode, Dictionary<string, Value>> - this will allow you to efficiently search for all three, and from only two of them you can get dictionaries and use the Values property to find all matching values ββfor the pair.
Jon skeet
source share