public int Add(T value)
        {
            if (this._listStore == null)
            {
                this._listStore = new SingleItemList <T>();
            }
            FrugalListStoreState state = this._listStore.Add(value);

            if (state != FrugalListStoreState.Success)
            {
                if (FrugalListStoreState.ThreeItemList != state)
                {
                    if (FrugalListStoreState.SixItemList != state)
                    {
                        if (FrugalListStoreState.Array != state)
                        {
                            throw new InvalidOperationException(System.Xaml.SR.Get("FrugalList_CannotPromoteBeyondArray"));
                        }
                        ArrayItemList <T> list3 = new ArrayItemList <T>(this._listStore.Count + 1);
                        list3.Promote(this._listStore);
                        this._listStore = list3;
                        list3.Add(value);
                        this._listStore = list3;
                    }
                    else
                    {
                        SixItemList <T> list2 = new SixItemList <T>();
                        list2.Promote(this._listStore);
                        this._listStore = list2;
                        list2.Add(value);
                        this._listStore = list2;
                    }
                }
                else
                {
                    ThreeItemList <T> list = new ThreeItemList <T>();
                    list.Promote(this._listStore);
                    list.Add(value);
                    this._listStore = list;
                }
            }
            return(this._listStore.Count - 1);
        }
 public override object Clone()
 {
     ThreeItemList<T> list = new ThreeItemList<T>();
     list.Promote((ThreeItemList<T>) this);
     return list;
 }