コード例 #1
0
    /// <summary>
    /// Method to get the index into the List{} in the base collection for an item that may or may
    /// not be in the collection. Returns -1 if not found.
    /// </summary>
    protected override int GetItemIndex(T itemToFind)
    {
        int keyToFind = GetKeyForItem(itemToFind);

        return(BaseList.FindIndex((T existingItem) =>
                                  GetKeyForItem(existingItem).Equals(keyToFind)));
    }
コード例 #2
0
        public void Commit()
        {
            BaseList.AddRange(_toAdd);
            BaseList.RemoveAll(x => _toDelete.Any(y => y.TransactionalListEquals(x)));

            foreach (var item in _toUpdate)
            {
                var ind = BaseList.FindIndex(x => x.TransactionalListEquals(item));
                BaseList[ind] = item;
            }

            _toAdd.Clear();
            _toDelete.Clear();
            _toUpdate.Clear();
        }