I have this class:
public class Change()
{
public int Id {get; set;}
public decimal Price {get; set;}
}
And I have 2 lists oldPrices and newPrices. Both lists contain the same items albeit different instances.
Some items in newPrices have different prices, so to get a list of changed prices I'm doing:
var list = newPrices
.Where(x => oldPrices.All(p => p.Price != x.Price))
.ToDictionary(x => x.Id, x => x.Price);
This expression should be correct but the list is empty even though there are changes.
What am I missing?
Allrequires that all prices be different. Did you mean to useAny?Idbut different prices? Or any items with a different price regardless of the id?