Sorry, I don't think I explained it very well.
I already have a list of customers in my database. Now I bought a separate list of customer leads. Some of the leads are already my customers, some of them aren't. So I need to cycle through the list of leads and check if each one is already a customer--if they are, I want to update them. If they're not, I want to add them.
(I don't have my dev machine handy, so this is pretty much pseudo code)
foreach (LeadEntity l in Leads)
{
bool found = false;
foreach (CustomerEntity c in Customers)
{
if (c.Name == l.Name)
{
//update c
c.PhoneNumber = l.PhoneNumber; //etc.
found = true;
}
}
if (!found)
{
//insert l
CustomerEntity newCust = new CustomerEntity(l.Name);
newCust.PhoneNumber = l.PhoneNumber; //etc.
Customers.Add(newCust);
}
}
Again, this is just an illustration of what I'm trying to accomplish.
My main question is whether the above would be most efficient, or using the Find method, or if there is some other way.
Thanks,
Phil