OnAddedToVehicle() приватный Метод

private OnAddedToVehicle ( Vehicle vehicle ) : void
vehicle Vehicle
Результат void
Пример #1
0
 /// <summary>
 /// Adds a wheel to the vehicle.
 /// </summary>
 /// <param name="wheel">WheelTest to add.</param>
 public void AddWheel(Wheel wheel)
 {
     if (wheel.vehicle == null)
     {
         Wheels.Add(wheel);
         wheel.OnAddedToVehicle(this);
     }
     else
     {
         throw new InvalidOperationException("Can't add a wheel to a vehicle if it already belongs to a vehicle.");
     }
 }
Пример #2
0
 /// <summary>
 /// Adds a wheel to the vehicle.
 /// </summary>
 /// <param name="wheel">WheelTest to add.</param>
 public void AddWheel(Wheel wheel)
 {
     if (wheel.vehicle == null)
     {
         Wheels.Add(wheel);
         wheel.OnAddedToVehicle(this);
     }
     else
         throw new InvalidOperationException("Can't add a wheel to a vehicle if it already belongs to a vehicle.");
 }