public ISet <string> GetCharacterIdsForType(CharacterRelationshipType relationshipType) { ISet <string> characterIdsForType = new HashSet <string>(); foreach (var relatedCharacters in GetAll().Where(rc => rc.RelationshipType == relationshipType)) { characterIdsForType.AddRange(relatedCharacters.CharacterIds); } return(characterIdsForType); }
public ISet <string> GetMatchingCharacterIds(string characterId, CharacterRelationshipType relationshipType) { ISet <string> result = new HashSet <string>(); var dictionary = GetCharacterIdToRelatedCharactersDictionary(); if (!dictionary.ContainsKey(characterId)) { return(result); } IEnumerable <RelatedCharacters> relatedCharactersSet = dictionary[characterId].Where(rc => rc.RelationshipType == relationshipType); foreach (var relatedCharacters in relatedCharactersSet) { result.AddRange(relatedCharacters.CharacterIds); } return(result); }