Good day to all
The question is simple, but I had problems all day.
I have 2 lists:
- list of ints (ids)
- list of objects (containing identifiers)
and I want to compare them, but I want to get an id that does not have a pair (if it exists)
I was wondering if there is a C # or linq method for determining values that differ in two arrays
Example
if I have
List<int> ids = {1,2,3,4,5}
and
List<objectX> x = (contains id,code, and description)
and I tried something like
foreach (int id in ids) { foreach (objectX item in x) { if (item.id == id) { break; } else idDiferentes.Add(id); } }
but as you can imagine, it does not work.
eg
ids= {1,2,3,4} objectx[id] ={1,3,2}
Ides are different when I compare them, so I get a larger list that I need
I also tried with an external linq connection, but I don't understand how this works very well