linq to objects trying to find object based on list of ids

I have

Class Spread

I am trying to find all spreads in a list where the spread contains a contractId from another list.  I can't figure it out.

Here is what I have tried:
public List<Spread> GetSpreadByContractIds(List<string> contractIds)
//var spreads = (from s in Spreads where contractIds.Contains(s => s.ContractIds) select s).ToList();
List<Spread> results = (from s in Spreads join cts in contractIds on s.ContractIds equals cts select s).ToList();
return results;
Who is Participating?
Gautham JanardhanConnect With a Mentor Commented:
List<Spread> results = (from s in Spreads 
where s.ContractIds.Any(x=>contractIds.Contains(x))
 select s).ToList();

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.