コード例 #1
0
        // Token: 0x060073A3 RID: 29603 RVA: 0x00211768 File Offset: 0x0020F968
        internal object LeafAt(int index)
        {
            int i     = 0;
            int count = base.Items.Count;

            while (i < count)
            {
                CollectionViewGroupInternal collectionViewGroupInternal = base.Items[i] as CollectionViewGroupInternal;
                if (collectionViewGroupInternal != null)
                {
                    if (index < collectionViewGroupInternal.ItemCount)
                    {
                        return(collectionViewGroupInternal.LeafAt(index));
                    }
                    index -= collectionViewGroupInternal.ItemCount;
                }
                else
                {
                    if (index == 0)
                    {
                        return(base.Items[i]);
                    }
                    index--;
                }
                i++;
            }
            throw new ArgumentOutOfRangeException("index");
        }
コード例 #2
0
        // return the item at the given index within the list of leaves governed
        // by this group
        internal object LeafAt(int index)
        {
            for (int k = 0, n = Items.Count; k < n; ++k)
            {
                CollectionViewGroupInternal subgroup = Items[k] as CollectionViewGroupInternal;
                if (subgroup != null)
                {
                    // current item is a group - either drill in, or skip over
                    if (index < subgroup.ItemCount)
                    {
                        return(subgroup.LeafAt(index));
                    }
                    else
                    {
                        index -= subgroup.ItemCount;
                    }
                }
                else
                {
                    // current item is a leaf - see if we're done
                    if (index == 0)
                    {
                        return(Items[k]);
                    }
                    else
                    {
                        index -= 1;
                    }
                }
            }

            // the loop should have found the index.  We shouldn't get here.
            throw new ArgumentOutOfRangeException("index");
        }