public int GetCountFor(IIntermediateMemberParent parent) { int result = 0; foreach (var member in this.Values) { if (member.Entry != null && member.Entry.Parent == parent) { result++; } } return(result); }
/// <summary> /// Returns an <see cref="IEnumerable{T}"/> of <see cref="KeyValuePair{TKey, TValue}"/> elements /// which are exclusively defined on the owning <paramref name="context"/>. /// </summary> /// <returns>An <see cref="IEnumerable{T}"/> of <see cref="KeyValuePair{TKey, TValue}"/> elements /// which are exclusively defined on the owning <paramref name="context"/>.</returns> /// <param name="context">The <see cref="IIntermediateMemberParent"/> which denotes /// the owning context that is relevant to the request.</param> public IEnumerable <KeyValuePair <IGeneralMemberUniqueIdentifier, MasterDictionaryEntry <IIntermediateMember> > > ExclusivelyOnParent(IIntermediateMemberParent context) { foreach (var element in this) { if (element.Value.Entry.Parent == context) { yield return(element); } else if (element.Value.Entry is IIntermediateSegmentableDeclaration) { var segMem = (IIntermediateSegmentableDeclaration)element.Value.Entry; foreach (IIntermediateMember partial in segMem.Parts) { if (partial.Parent == context) { yield return(new KeyValuePair <IGeneralMemberUniqueIdentifier, MasterDictionaryEntry <IIntermediateMember> >(element.Key, new MasterDictionaryEntry <IIntermediateMember>(element.Value.Subordinate, partial))); } } } } }
internal void ConditionalRemove(IIntermediateMemberParent parent) { this._RemoveSet(from element in this where element.Value.Entry.Parent == parent select element.Key); }