public SpecificSport this[SpecificSport.Name ind] { set { int i = Find(ind); if (i == -1) { throw new FieldAccessException("Invalid sport name"); } _score -= _SpecificSport[i].GetResult(); _SpecificSport.RemoveAt(i); _SpecificSport.Insert(i, value); _score += value.GetResult(); } get { int i = Find(ind); if (i == -1) { throw new FieldAccessException("Invalid sport name"); } return(_SpecificSport[i]); } }
public int Find(SpecificSport.Name value) { for (int i = 0; i < _SpecificSport.Count; i++) { if (_SpecificSport[i].GetSportName() == value) { return(i); } } return(-1); }