示例#1
0
        public static ArraySkipTakeReverseListWithProjection <TIn, T> Take <TIn, T>(
            this ArraySkipTakeReverseListWithProjection <TIn, T> source,
            int take)
        {
            var finalTake = Math.Min(source.count, take);

            if (source.iterateForward)
            {
                return(new ArraySkipTakeReverseListWithProjection <TIn, T>(
                           source.array,
                           source.offset,
                           finalTake,
                           source.iterateForward,
                           source.projection));
            }
            else
            {
                return(new ArraySkipTakeReverseListWithProjection <TIn, T>(
                           source.array,
                           source.offset + source.count - finalTake,
                           finalTake,
                           source.iterateForward,
                           source.projection));
            }
        }
示例#2
0
 internal static ArraySkipTakeReverseListWithProjection <TIn, T> Reverse <TIn, T>(
     this ArraySkipTakeReverseListWithProjection <TIn, T> source)
 {
     return(new ArraySkipTakeReverseListWithProjection <TIn, T>(
                source.array,
                source.offset,
                source.count,
                !source.iterateForward,
                source.projection));
 }
示例#3
0
                public Enumerator(ArraySkipTakeReverseListWithProjection <TIn, T> arrayClass)
                {
                    this.iterateForward = arrayClass.iterateForward;
                    this.count          = arrayClass.count;
                    this.offset         = arrayClass.offset;
                    this.projection     = arrayClass.projection;
                    this.array          = arrayClass.array;

                    if (this.iterateForward)
                    {
                        this.index = -1;
                    }
                    else
                    {
                        this.index = arrayClass.count;
                    }
                }