Exemple #1
0
 public static ArraySkipTakeReverseList <T> Skip <T>(
     this ArraySkipTakeReverseList <T> array,
     int skip)
 {
     if (array.iterateForward)
     {
         // **[--->]*
         // **[|-->]*
         return(new ArraySkipTakeReverseList <T>(
                    array.array,
                    skip,
                    array.Count - skip,
                    array.iterateForward));
     }
     else
     {
         // **[<---]*
         // **[<--|]*
         return(new ArraySkipTakeReverseList <T>(
                    array.array,
                    array.offset,
                    array.count - skip,
                    array.iterateForward));
     }
 }
Exemple #2
0
        public static T[] ToArray <T>(
            this ArraySkipTakeReverseList <T> array)
        {
            var t = new T[array.Count];

            array.CopyTo(0, t, array.Count);
            return(t);
        }
Exemple #3
0
 public static ArraySkipTakeReverseList <T> Reverse <T>(
     this ArraySkipTakeReverseList <T> source)
 {
     return(new ArraySkipTakeReverseList <T>(
                source.array,
                source.offset,
                source.count,
                !source.iterateForward));
 }
Exemple #4
0
 public static ArraySkipTakeReverseListWithProjection <TIn, T> Select <TIn, T>(
     this ArraySkipTakeReverseList <TIn> source,
     Func <TIn, T> projection)
 {
     return(new ArraySkipTakeReverseListWithProjection <TIn, T>(
                source.array,
                source.offset,
                source.count,
                source.iterateForward,
                projection));
 }
Exemple #5
0
        public static ArraySkipTakeReverseList <T> Take <T>(
            this ArraySkipTakeReverseList <T> array,
            int take)
        {
            var finalTake = Math.Min(array.count, take);

            if (array.iterateForward)
            {
                return(new ArraySkipTakeReverseList <T>(
                           array.array,
                           array.offset,
                           finalTake,
                           array.iterateForward));
            }
            else
            {
                return(new ArraySkipTakeReverseList <T>(
                           array.array,
                           array.offset + array.count - finalTake,
                           finalTake,
                           array.iterateForward));
            }
        }
Exemple #6
0
 public Enumerator(ArraySkipTakeReverseList <T> arrayClass)
 {
     this.arrayClass = arrayClass;
     this.index      = -1;
 }