title: Linq RemoveAll for a predicate condition on a list inside the collection
body: <p>I for the life of me cannot figure out what this LINQ query needs to be. I do fine on standard LINQ queries but in this case I need to check the condition of items in a list within a collection.</p>
  
  <p><strong>The Task:</strong></p>
  
  <p>I need to remove all messages in the collection where their list of recipients does not have all there handles containing a certain string i.e. "thiscompany.com".</p>
  
  <p><strong>My Attempt So Far:</strong></p>
  
  <pre><code>// Remove internal messages
  var internalMessages = messages._results
      .Where(x =&gt; x.recipients.All(y =&gt; y.handle.Contains("somecompany.com")));
  messages._results = messages._results.Except(internalMessages).ToList();
  </code></pre>
  
  <p>As far as I understand this approach would work fine I would just need to implement equality checking on the Message object but for certain reasons I am unable to do this. I know there must be a way with LINQ to execute a one liner that removes all messages based on this sub condition of the Recipients List but I just can't figure out where to go from here.</p>
  
  <p><strong>Message Object:</strong></p>
  
  <pre><code>public class Message
  {
      public _Links _links { get; set; }
      public string id { get; set; }
      public string type { get; set; }
      public bool is_inbound { get; set; }
      public float created_at { get; set; }
      public string blurb { get; set; }
      public Author author { get; set; }
      public List&lt;Recipient&gt; recipients { get; set; }
      public string body { get; set; }
      public string text { get; set; }
      public List&lt;Attachment&gt; attachments { get; set; }
      public MessageMetadata metadata { get; set; }
  }
  </code></pre>
  
  <p><strong>Recipient Object:</strong></p>
  
  <pre><code>public class Recipient
  {
      public _Links _links { get; set; }
      public string handle { get; set; }
      public string role { get; set; }
  }
  </code></pre>