title: Comparing two lists using linq to sql
body: <p>Say I have two lists:</p>
  
  <pre><code>List&lt;CanidateSkill&gt; canidateSkills;
  List&lt;JobDesiredSkill&gt; desiredSkills;
  
  class CanidateSkill
  {
      public Guid CanidateId { get; set; }
      public Guid SkillId { get; set; }
  }
  
  class JobDesiredSkill
  {
      public Guid JobId { get; set; }
      public Guid SkillId { get; set; }
  }
  </code></pre>
  
  <p>How do you determine if:</p>
  
  <ol>
  <li><p>At least one item in JobDesiredSkills is contained in CandidateSkills (matched on SkillId)</p></li>
  <li><p>All items in JobDesiredSkills are contained in CandidateSkills</p></li>
  </ol>
  
  <p>I tried this, but get this error: Unable to create a constant value of type  Only primitive types ('such as Int32, String, and Guid') are supported in this context. </p>
  
  <pre><code> return from candidate in _db.Candidates                           
   where (candidate.CandidateSkills.Any(c =&gt; job.JobDesiredSkills.Any(j =&gt; j.SkillId == c.SkillId))) 
   select candidate;
  </code></pre>
  
  <p>I also tried this, but Contains expects a JobDesiredSkill object, but c is a CandidateSkillObject.</p>
  
  <pre><code> return from candidate in _db.Candidates                           
   where CandidateSkills.Any(c =&gt; JobDesiredSkills.Contains(c)) 
   select candidate;
  </code></pre>
  
  <p>Thanks</p>