Example #1
0
        public Slice_ <T> Slice(int start, int count = int.MaxValue)
        {
            var slice = new Slice_ <T>();

            slice._list  = this._list;
            slice._start = this._start + start;
            slice._count = CheckParam.ThrowIfStartOrCountAreBelowZeroAndLimitCountIfNecessary(start, count, this._count);
            return(slice);
        }
Example #2
0
        public Slice_ <T> Slice(int start, int count)
        {
            if (start < 0)
            {
                throw new ArgumentException("The start index was below zero.");
            }
            if (count < 0)
            {
                throw new ArgumentException("The count was below zero.");
            }
            var slice = new Slice_ <T>();

            slice._list  = this._list;
            slice._start = this._start + start;
            slice._count = count;
            if (slice._count > this._count - start)
            {
                slice._count = System.Math.Max(this._count - start, 0);
            }
            return(slice);
        }