コード例 #1
0
        private void IdentityCollection_CollectionChangeRemoved(object sender, IdentityCollectionRemoveEventArgs e)
        {
            List <IIdentifier> list = new List <IIdentifier>(e.RemovedItems);
            IdentityCollectionRemoveEventArgs args =
                new IdentityCollectionRemoveEventArgs(list);

            CollectionChangeRemoved?.Invoke(this, args);
        }
コード例 #2
0
        /// <summary>
        /// Removes given item from collection, if collection contains this item.
        /// </summary>
        /// <param name="item">Item to remove from collection.</param>
        public void RemoveItem(T item)
        {
            List <IIdentifier> list = new List <IIdentifier>();

            if (Remove(item))
            {
                list.Add(item.Identifier);
                IdentityCollectionRemoveEventArgs args =
                    new IdentityCollectionRemoveEventArgs(list);
                CollectionChangeRemoved?.Invoke(this, args);
            }
        }
コード例 #3
0
        /// <summary>
        /// Removes given items from collection, if collection contains these items.
        /// </summary>
        /// <param name="items">Items to remove from collection.</param>
        public void RemoveRange(IEnumerable <T> items)
        {
            List <IIdentifier> list = new List <IIdentifier>();

            foreach (T target in items)
            {
                if (Remove(target))
                {
                    list.Add(target.Identifier);
                }
            }
            if (list.Count > 0)
            {
                IdentityCollectionRemoveEventArgs args =
                    new IdentityCollectionRemoveEventArgs(list);
                CollectionChangeRemoved?.Invoke(this, args);
            }
        }