/// <summary> /// Remove an anonymous item from this group. /// </summary> /// <param name="item"></param> public bool RemoveAnonymousItem(U item, bool searchRecursive = true) { if (!AnonymousItems.Remove(item) && searchRecursive) { if (IsLeaf) { return(false); } return(Subnodes.Any(kvp => kvp.Value.RemoveAnonymousItem(item, searchRecursive))); } if (OnItemRemoved != null) { OnItemRemoved(null, item); } return(true); }
/// <summary> /// Check if this group contains the given item. /// </summary> /// <param name="item"></param> /// <returns></returns> public bool ContainsItem(U item, bool searchRecursive = true) { return(Items.ContainsValue(item) || ( searchRecursive ? Subnodes.Any(kvp => kvp.Value.ContainsItem(item)) : false )); }