S
shapper
Hello,
I have two Lists:
A = {ID, Name} = { (Null, John), (Null, Mary), (Null, Andrew), (Null,
Peter) }
B = {ID, Name} = { (1, John), (2, Robert), (3, Angela), (4, Andrew) }
I want to find which items in A do not exist in B then:
1. Add the items to B and using an ID from the function GetID(). B
would become:
B = {ID, Name} = { (1, John), (2, Robert), (3, Angela), (4,
Andrew), (231, Mary), (45, Peter) }
2. Then update the A list, or create a new one (C), to get the created
items:
C = {ID, Name} = { (231, Mary), (45, Peter) }
How can I do this with LINQ?
I have been trying a join but with the something as "not equals" but
it does not work.
I think I might need to do this in 3 steps:
1. Get items in B that do not exist in C;
2. Insert those items in C;
3. Get those items again from C to get the created ID's with the
correspondent names.
Could someone help me out with this?
Thanks,
Miguel
I have two Lists:
A = {ID, Name} = { (Null, John), (Null, Mary), (Null, Andrew), (Null,
Peter) }
B = {ID, Name} = { (1, John), (2, Robert), (3, Angela), (4, Andrew) }
I want to find which items in A do not exist in B then:
1. Add the items to B and using an ID from the function GetID(). B
would become:
B = {ID, Name} = { (1, John), (2, Robert), (3, Angela), (4,
Andrew), (231, Mary), (45, Peter) }
2. Then update the A list, or create a new one (C), to get the created
items:
C = {ID, Name} = { (231, Mary), (45, Peter) }
How can I do this with LINQ?
I have been trying a join but with the something as "not equals" but
it does not work.
I think I might need to do this in 3 steps:
1. Get items in B that do not exist in C;
2. Insert those items in C;
3. Get those items again from C to get the created ID's with the
correspondent names.
Could someone help me out with this?
Thanks,
Miguel