public void Load(string filename) { DataTable dt = Utilities.Parser(filename); BrisRace currentRace = null; _race.Clear(); foreach (DataRow dr in dt.Rows) { var horse = new BrisHorse(dr); // The following if ensures that when a new race is comming // we create a new race object and start populating it if ((currentRace == null) || (horse.RaceNumber != currentRace.RaceNumber)) { currentRace = new BrisRace(horse.RaceNumber, this); _race.Add(currentRace); } Debug.Assert(null != currentRace); Debug.Assert(null != horse); horse.Parent = currentRace; currentRace.Add(horse); } }
internal BrisHorse(DataRow dr) { _parent = null; _dr = dr; }