How to compare 2 lists values?
<p>I have 2 lists and I would like to remove the items when the items from the first list is not present in the second list.</p>

<pre><code> public class ResolutionsRow
{
    public String Name { get; set; }
    public int ID { get; set; }
}

public List&lt;ResolutionsRow&gt; Categories { get; set; }
</code></pre>

<hr>

<p>In the following Category.LoadForProject(project.ID) returns an IList</p>

<pre><code>DeleteItems(Category.LoadForProject(project.ID), Categories);
</code></pre>

<hr>

<pre><code>private void DeleteItems(dynamic currentItems, dynamic items) 
            {
                if (currentItems != null)
                {
                    foreach (var existingItem in currentItems)
                    {
                        if (items.Contains(existingItem.Name))
                           items.Remove(existingItem.Name);
                    }
                } 
            }
</code></pre>

<p>I am having the error message</p>

<blockquote>
  <p>The best overloaded method match for 'System.Collections.Generic.List.Contains(MvcUI.Models.ResolutionsRow)' has some invalid arguments.  What is wrong with my code and how can I correct it? Help please.</p>
</blockquote>

<p>I have tried to change the code to, but I am having the error message </p>

<blockquote>
  <p>Error 6   Argument 1: cannot convert from 'int' to API.Category'  MvcUI\Models\ProjectModel.cs    255 44  MvcUI
  Error 5   The best overloaded method match for 'System.Collections.Generic.ICollection.Contains(API.Category)' has some invalid arguments   MvcUI\Models\ProjectModel.cs    255 24  MvcUI</p>
</blockquote>

<hr>

<pre><code>var categories = Category.LoadForProject(project.ID);
                foreach (var item in Categories)
                {
                    if(categories.Contains(item.ID))
                   {

                   }
                }
</code></pre>
