Efficient and Accurate way to add items into a TList
<p>I have 2 lists and the entities of the those lists have some IDs for instance</p>

<p><code>Client.ID,</code> where ID is a property of Client anf then I have <code>PopulationClient.ID</code>, where ID is a property of the class PopulationClient. So I have two Lists</p>

<pre><code>TList&lt;Client&gt; clients = clientsHelper.GetAllClients();
TList&lt;PopulationClient&gt; populationClients = populationHelper.GetAllPopulationClients();
</code></pre>

<p>So then I have a temp List</p>

<pre><code>TList&lt;Client&gt; temp_list = new TList&lt;Client&gt;();
</code></pre>

<p>So the problem i am having is doing this efficiently and correctly. This is what I have tried.. but I am not getting the correct results</p>

<pre><code>foreach(PopulationClient pClients in populationClients)
{
    foreach(Client client in clients)
     {
         if(pClients.ID != client.ID  &amp;&amp;  !InTempList(temp_list, pClients.ID))
         {
             temp_list.Add(client);
         }
     }
}

public bool InTempList(TList&lt;Client&gt; c, int id)
{
    bool IsInList = false;
    foreach(Client client in c)
    {
        if(client.ID == id)
        {
              IsInList = true;
        }
    }    
   return IsInList;
}
</code></pre>

<p>So while I am trying to do it right I can not come up with a good way of doing it, this is not returning the correct data because in my statement in the first loop at the top,at some point one or more is different to the otherone so it adds it anyways. What constraints do you think I should check here  so that I only end up with a list of Clients that are in population clients but not in Clients?.</p>

<p>For instance population clients would have 4 clients and Clients 2, those 2 are also in population clients but I need to get a list of population clients not in Clients.</p>

<p>ANy help or pointers would be appreciated.</p>
