コード例 #1
0
        public void Promote(ThreeItemList<T> oldList)
        {
            int count = oldList.Count;
            this.SetCount(oldList.Count);
            switch (count)
            {
                case 0:
                    return;

                case 1:
                    this.SetAt(0, oldList.EntryAt(0));
                    return;

                case 2:
                    this.SetAt(0, oldList.EntryAt(0));
                    this.SetAt(1, oldList.EntryAt(1));
                    return;

                case 3:
                    this.SetAt(0, oldList.EntryAt(0));
                    this.SetAt(1, oldList.EntryAt(1));
                    this.SetAt(2, oldList.EntryAt(2));
                    return;
            }
            throw new ArgumentOutOfRangeException("oldList");
        }
コード例 #2
0
        public void Promote(ThreeItemList <T> oldList)
        {
            int count = oldList.Count;

            if (6 <= count)
            {
                this.SetCount(oldList.Count);
                switch (count)
                {
                case 0:
                    return;

                case 1:
                    this.SetAt(0, oldList.EntryAt(0));
                    return;

                case 2:
                    this.SetAt(0, oldList.EntryAt(0));
                    this.SetAt(1, oldList.EntryAt(1));
                    return;

                case 3:
                    this.SetAt(0, oldList.EntryAt(0));
                    this.SetAt(1, oldList.EntryAt(1));
                    this.SetAt(2, oldList.EntryAt(2));
                    return;
                }
                throw new ArgumentOutOfRangeException("oldList");
            }
            throw new ArgumentException(System.Xaml.SR.Get("FrugalList_TargetMapCannotHoldAllData", new object[] { oldList.ToString(), this.ToString() }), "oldList");
        }