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)); } }
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)); }
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; } }