i am having two list collections one for new persons and one for existing persons and my condition is if the record in new person matches with existing person it should remove the record from existing person for that i am using the following code
foreach(var p in existingperson)
{
if(newperson.id==p.id)
{
existingperson.remove(p);
return true;
}
else
{
return false;
}
}
its throwing an exception that i cant change collection in iteration.for using for loop i dont know the count of existing records..please help