/// <summary> /// Removes a wheel from the vehicle. /// </summary> /// <param name="wheel">WheelTest to remove.</param> public void RemoveWheel(Wheel wheel) { if (wheel.vehicle == this) { wheel.OnRemovedFromVehicle(); Wheels.Remove(wheel); } else { throw new InvalidOperationException("Can't remove a wheel from a vehicle that does not own it."); } }
/// <summary> /// Removes a wheel from the vehicle. /// </summary> /// <param name="wheel">WheelTest to remove.</param> public void RemoveWheel(Wheel wheel) { if (wheel.vehicle == this) { wheel.OnRemovedFromVehicle(); Wheels.Remove(wheel); } else throw new InvalidOperationException("Can't remove a wheel from a vehicle that does not own it."); }