예제 #1
0
        /// <summary>
        /// Removes the given item from this group if it exists.
        /// </summary>
        /// <param name="item">The item to remove.</param>
        /// <returns>true if the item was removed, false if it wasn't.</returns>
        public bool RemoveItem(ManifestItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            for (int i = 0; i < _items.Count; i++)
            {
                if (String.Compare(_items[i].Name, item.Name, true) == 0)
                {
                    _items[i].Group = null;
                    _items.RemoveAt(i);
                    return(true);
                }
            }

            return(false);
        }
예제 #2
0
        /// <summary>
        /// Add the given item to this group if it isn't already a member.
        /// </summary>
        /// <param name="item">The item to add.</param>
        /// <returns>true if the item was added, false if it wasn't.</returns>
        public bool AddItem(ManifestItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            foreach (ManifestItem i in Items)
            {
                if (String.Compare(i.Name, item.Name, true) == 0)
                {
                    return(false);
                }
            }

            item.Group = this;
            _items.Add(item);
            return(true);
        }