public List <Pokemon> GetAllPokemonOfType(Pokemon.PokemonType type) { // create list to save pokemon of same type PokeDex pokemons = new PokeDex(); // check each pokemon for the matching type foreach (Pokemon pokemon in this) { if (pokemon.Type1 == type || pokemon.Type2 == type) { pokemons.Add(pokemon); } } // return a PokeDex containing only pokemon of matching type return(pokemons); }