예제 #1
0
        public virtual void RemoveWaggonAt(int index)
        {
            Contract.Requires <ArgumentOutOfRangeException>(index >= 0 && index < Waggons.Count());

            Contract.Assume(index < Waggons.Count());

            this._waggons.RemoveAt(index);
        }
예제 #2
0
        /// <summary>
        ///     Moves a waggon at the specified index one step up.
        /// </summary>
        /// <param name="index">The index of the waggon.</param>
        public virtual void MoveWaggonUpAt(int index)
        {
            Contract.Requires <ArgumentOutOfRangeException>(index >= 0 && index < Waggons.Count());

            Contract.Assume(index < this._waggons.Count);

            Waggon waggon = this._waggons[index];

            this._waggons.RemoveAt(index);
            this._waggons.Insert(index - 1, waggon);
        }