I have 2 List<object> . The first, lets call it ListA is more like a complete list, and the second ListB is a modified list. Now I want to change ListA using ListB. Is it doable and how can I do it. This is what I have so far but not working:
var ListB = _repository.Get(m => m.Approved == true).ToList(); foreach (var x in ListB) { ListA.Where(d => d.Name == x.Name).First() = x; } return ListA;
EDIT: A visual presentation to describe what “change” means in my situation.
ListA Id Name Age 1 John 14 2 Mark 15 3 Luke 13 4 Matthew 18 ListB Id Name Age 2 Mark 0 4 Matthew 99
After the “modification”, ListA should look like this:
ListA Id Name Age 1 John 14 2 Mark 0 3 Luke 13 4 Matthew 99
c #
super-user
source share