Version 2017.5.1.1345-beta
Pre-releaseThis beta-release simply adds an extension method based on the diff operations that can be used to mutate lists.
A typical scenario is that you have a list that you want to mutate such that it has the same items as another collection. However, since something is observing changes to the list you want to mutate, you don't simply want to clear it and re-add all the elements it is supposed to have. Instead you would like to insert new elements in the right places and remove elements that should no longer be there.
The new extension method does just that:
It is called by:
(List<T> variable).MutateToBeLike(otherCollection, optionalComparer, optionalElementAligner);
In its simplest form:
(List<T> variable).MutateToBeLike(otherCollection);
It will take elements from otherCollection
and insert into your list in the right places, and also remove items from your list if they should no longer be there.