public ICollection <KeyValuePair <TPrimaryKey, TValue> > SecondaryKeyEntries(TSecondaryKey secondaryKey) { var result = ImmutableList.CreateBuilder <KeyValuePair <TPrimaryKey, TValue> >(); foreach (var entry in dictionary) { if (entry.Value.ContainsKey(secondaryKey)) { foreach (var secondaryEntry in entry.Value) { result.Add(KeyValuePairs.Of(entry.Key, secondaryEntry.Value)); } } } return(result.ToImmutable()); }