Exemplo n.º 1
0
        public VersionedList <T> Replace(T oldValue, T newValue)
        {
            var index = Items.IndexOf(oldValue);

            return(new VersionedList <T>(
                       Items.Replace(oldValue, newValue),
                       Version + 1,
                       Changes.Add(ListChange.Replaced(Version, index, oldValue, newValue))
                       ));
        }
Exemplo n.º 2
0
        public VersionedList <T> SetItem(int index, T newItem)
        {
            var oldItem = Items[index];

            return(new VersionedList <T>(
                       Items.SetItem(index, newItem),
                       Version + 1,
                       Changes.Add(ListChange.Replaced(Version, index, oldItem, newItem))
                       ));
        }
Exemplo n.º 3
0
        public VersionedList <T> Replace(T oldValue, T newValue, IEqualityComparer <T> equalityComparer)
        {
            var index = Items.IndexOf(oldValue, equalityComparer);

            return(new VersionedList <T>(
                       Items.Replace(oldValue, newValue, equalityComparer),
                       Version + 1,
                       Changes.Add(ListChange.Replaced(Version, index, oldValue, newValue))
                       ));
        }