Пример #1
0
        public override void Insert(int index, T value)
        {
            if (this._count >= 1 || index >= 1)
            {
                throw new ArgumentOutOfRangeException("index");
            }
            this._loneEntry = value;
            SingleItemList <T> singleItemList = this;

            singleItemList._count = singleItemList._count + 1;
        }
Пример #2
0
        public override void RemoveAt(int index)
        {
            if (index != 0)
            {
                throw new ArgumentOutOfRangeException("index");
            }
            this._loneEntry = default(T);
            SingleItemList <T> singleItemList = this;

            singleItemList._count = singleItemList._count - 1;
        }
Пример #3
0
        public override FrugalListStoreState Add(T value)
        {
            if (this._count != 0)
            {
                return(FrugalListStoreState.ThreeItemList);
            }
            this._loneEntry = value;
            SingleItemList <T> singleItemList = this;

            singleItemList._count = singleItemList._count + 1;
            return(FrugalListStoreState.Success);
        }
Пример #4
0
        public override bool Remove(T value)
        {
            if (!this._loneEntry.Equals(value))
            {
                return(false);
            }
            this._loneEntry = default(T);
            SingleItemList <T> singleItemList = this;

            singleItemList._count = singleItemList._count - 1;
            return(true);
        }
Пример #5
0
 public void Promote(SingleItemList <T> oldList)
 {
     this.SetCount(oldList.Count);
     this.SetAt(0, oldList.EntryAt(0));
 }