I have a list of objects as such:
someID: 1234 values: A, B
someID: 891 values: C
I have a datatable with some rows.
1234 D
891 E
1234 F
I want to add these values from the datatable
to their respective objects in the list in-memory. So for example, I want to find the object with ID
1234 in the list and add values D
and F
to the object.
What would have the best performance?
- Sort the datatable the iterate it through, search list each time
- Store datatable into a hashtable/dictionary, then iterate through the list performing a dictionary lookup on each key
- Something else?
Edit: not really a DB question, I'll try to make it more clear