.NET 6 IntersectBy and ExceptBy
I often try to see the delta between two lists to see what needs to be added or deleted. Microsoft finally addressed this with new extensions IntersectBy and ExceptBy.
var added = MyValues.ExceptBy(entities.Select(s => s.Name), p => p.Name).ToList(); var removed = entities.ExceptBy(MyValues.Select(s => s.Name), p => p.Name).ToList();
https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.exceptby
https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.intersectby