I have created two lists of objects: One is records from an xml and the other is records from the database.
The rule is check if the record from an xml exist in the database then exclude.
I have thought of two options:
First is to loop the list of records from an xml and for each record check if the id exist in the database.
Second is creating a list of objects from an xml and a list of objects from the database. Then compare the two list and get the result.
Which one is efficient? I'm thinking of the second options because instead of looping and querying the record, each time, if existed in the database why not put them in the lists and compare them by using linq or equality comparer.