title: Find and remove elements from List<Dictionary<string, object>>
body: <p>I'm currently working on a C# 4.7.2 application. I'm about to write an extension method for a custom type and I'm struggling with my LINQ query unfortunately.</p>
  
  <p>I need filter a <code>List&lt;Dictionary&lt;string, object&gt;&gt;</code> to find the elements of <code>Dictionary&lt;string, object&gt;</code> in the list with a certain key and remove it from my list. Furthermore, a list entry can be null.</p>
  
  <p>A list entry (dictionary) can look like this, there can be several elements with value key A, i need to remove all actually:</p>
  
  <pre><code>Key    |  Value
  "MyId" : "A",
  "Width" : 100,
  "Length" : 50
  </code></pre>
  
  <p>Very simple structure. The tricky thing is to find the dictionary elements in the list. My extension method looks like that:</p>
  
  <pre><code>public static List&lt;Dictionary&lt;string, object&gt;&gt; RemoveItem(this List&lt;Dictionary&lt;string, object&gt; items, string value)
  {
      var itemToRemove = items.FirstOrDefault(x =&gt; x.ContainsKey("MyId")).Values.Contains(value);
  
      items.Remove(itemToRemove);
  
      return items;
  }
  </code></pre>
  
  <p>Unfortunately this LINQ query does not work correctly.</p>
  
  <p>Do you know how to solve this issue?</p>
  
  <p>Thank you very much!!</p>