title: Compare with list using linq
body: <p>I have a list <code>cids</code> that I am fetching like this</p>
  
  <pre><code>var cids = _service.Employee.Where(i =&gt; i.EmpID == _empID).Select(j =&gt; j.ClientID).ToList();
  </code></pre>
  
  <p>I want to compare this list with <code>Patient Entity</code> and get all the records of patients that matches the clientId in the <code>cid list</code></p>
  
  <p>Patient Entity is like this</p>
  
  <pre><code>class Patient   
  {   
      Int PatientID{ get; set;}   
      Int ClientID{get; set;}   
      string PatientName{get; set;}
  }
  </code></pre>
  
  <p>Right now I am doing it like this</p>
  
  <pre><code>foreach(var item in cids)
  {
       var pp = from p1 in _service.Patients
                              where p1.ClientId == item
                              select new PatientDTO
                              {
                                  PatientID = p1.PatientID,
                                  PatientName = p1.PatientName,
  
                              };
       prec.Add(pp);
  }
  </code></pre>
  
  <p>Is there a way to do it with <code>Linq</code> without using <code>foreach</code></p>