I have two data sets (lists of complex objects or SQL data - LINQ to Entities) where im trying to find the intersection of two data sets. In particular, the intersection of the Complex property, "HashData", as shown below:

The set on the left is likely to be around 10,000 lines, while the set on the right is always a subset of about 100 lines. I understand that if I sort the set of βHashdataβ on the left while storing it, the search will be much faster using some kind of binary search algorithm, however I cannot do this for reasons not related to the question.
A smaller subset of data is never stored in SQL (shown only in the SQL table below for clarification). It is presented in List<ShowData> at runtime.
At the moment, I am doing a miserable loop through the data and matching them (where recording is 100 lines of the list and ShowData is the list of lines 10,000):
List<ShowData> ShowData = (from showData in context.ShowDatas where (showData.Show.Id == advert.Id) orderby showData.HashData ascending select showData).ToList(); foreach (ShowData recording in recordingPoints) { foreach (ShowData actual in ShowData) { if (recording.HashData == actual.HashData) { } } }
So basically what I'm trying to do is:
Returns a list of ShowData objects (large set), where any HashData (from a small set) is in ShowData, but inside the original LINQ to Entity query to the database.
I got closer:
private IEnumerable<ShowData> xyz(List<ShowData> aObj, List<ShowData> bObj) { IEnumerable<string> bStrs = bObj.Select(b => b.HashData).Distinct(); return aObj.Join(bStrs, a => a.HashData, b => b, (a, b) => a); }