title: linq : find values in list exist in another list or not?
body: <p>I have a small problem, from the below code first we are finding hostelStops with ID, hostelName, InTime
  then we are taking wardenkduty with DutyName, tasksStart</p>
  <p>now, I want to check whether hostelStops-hostelName is exist in taskList-taskStart</p>
  <pre class="lang-cs prettyprint-override"><code>var hostelStops = 
      (from item in Hostel.Where(tn =&gt; tn.HostelNumber == hostelNumber).SelectMany(x =&gt; x.Hostels)
      select new
      {
          Id = item.Id,
          hostelName = hostelName.Single(p =&gt; p.Id == item.hostelId).SymbolicName,
          InTime = item.InTimeTime                                 
      }).ToList();
  
  var taskList = 
      (from row in filteredWardenDuty
      select new
      {
          dutyName = row.DutyName,
          taskStart = row.WardenTasks.Select(x =&gt; x.Context.Start.PlaceId)
      }).ToList();                             
  </code></pre>
  <p>so, i have written below code</p>
  <pre class="lang-cs prettyprint-override"><code>var isExist = 
      from row in taskList
      select new
      {
          task = row.taskStart.Contains((from item in hostelStops select item.hostelName ))
      };
  </code></pre>
  <p>but, receiving error as</p>
  <blockquote>
  <p>Error CS1929  'IEnumerable' does not contain a definition for 'Contains' and the best extension method overload 'MemoryExtensions.Contains&lt;IEnumerable&gt;(ReadOnlySpan&lt;IEnumerable&gt;, IEnumerable)' requires a receiver of type 'ReadOnlySpan&lt;IEnumerable&gt;'</p>
  </blockquote>