Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new rope and initializes it with a part of this rope.
        /// Runs in O(lg N) plus a per-node cost as if <c>this.Clone()</c> was called.
        /// </summary>
        /// <exception cref="ArgumentOutOfRangeException">offset or length is outside the valid range.</exception>
        /// <remarks>
        /// This method counts as a read access and may be called concurrently to other read accesses.
        /// </remarks>
        public Rope <T> GetRange(int index, int count)
        {
            VerifyRange(index, count);
            Rope <T> newRope  = Clone();
            int      endIndex = index + count;

            newRope.RemoveRange(endIndex, newRope.Length - endIndex);
            newRope.RemoveRange(0, index);
            return(newRope);
        }