Beispiel #1
0
        /// <summary>
        /// Shifts a subset of a list of items in place.
        /// </summary>
        public static void Shift <T>(this IList <T> list, int offset, int from, int to)
        {
            if (list is T[] arr)
            {
                ArrayExtensions.Shift(arr, offset, from, to);
                return;
            }

            offset = SlurMath.RepeatPositive(-offset, to - from);
            Reverse(list, from, from + offset);
            Reverse(list, from + offset, to);
            Reverse(list, from, to);
        }