//View //Other public void newTeam(int number, string binary) { Team team = new Team(number, binary); for (int i = 0; i < teams.Length; i++) { if (teams[i] == null) { teams[i] = team; break; } } }
private void btnMatchTeam_Click(object sender, EventArgs e) { Team input = searchNumber(teams, int.Parse(tbMatchTeam.Text)); if (input != null) { selected = input; lblMatchTeam.Text = "Team: " + selected.number; } else { lblMatchTeam.Text = "Team: "; } }
public Team searchNumber(Team[] teams, int number) { foreach (Team team in teams) { if (team != null) { if (team.number == number) { return team; } } } return null; }