コード例 #1
0
 public void AddLapTime(VehicleLapTime lapTime)
 {
     if (!_lapTimes.Any(l => l.LapNumber == lapTime.LapNumber))
     {
         _lapTimes.Add(lapTime);
     }
 }
コード例 #2
0
        public void AddLapTime(VehicleLapTime lapTime)
        {
            var vehicleLaps = _vehicleLapTimes.FirstOrDefault(v => v.CarNumber == lapTime.CarNumber);

            if (vehicleLaps == null)
            {
                vehicleLaps = new VehicleLapTimes(lapTime.CarNumber);
                _vehicleLapTimes.Add(vehicleLaps);
            }

            vehicleLaps.AddLapTime(lapTime);
        }