public List <Pokeball> GetPokeballs(int characterID) { List <object[]> data = context.GetPokeballs(characterID); List <Pokeball> pokeballs = new List <Pokeball>(); foreach (object[] row in data) { for (int i = 0; i < Convert.ToInt32(data[5]); i++) { pokeballs.Add(new Pokeball(Convert.ToInt32(row[0]), row[1].ToString(), Convert.ToInt32(row[2]), row[3].ToString(), Convert.ToInt32(row[4]))); } } return(pokeballs); }