Class SkipTransformer<T>
- Namespace
- Wolfgang.Etl.Transformers
- Assembly
- Wolfgang.Etl.Transformers.dll
A transformer that skips a fixed number of items from the start of the input sequence and yields the rest unchanged.
public sealed class SkipTransformer<T> : ITransformAsync<T, T> where T : notnull
Type Parameters
TThe type of items flowing through the transformer. Must be non-null.
- Inheritance
-
SkipTransformer<T>
- Implements
-
ITransformAsync<T, T>
- Inherited Members
- Extension Methods
Examples
// skip the first row (header) before processing the rest
var dataOnly = new SkipTransformer<Row>(count: 1);
Remarks
SkipTransformer<T> is the transformer equivalent of LINQ's
Skip<TSource>(IEnumerable<TSource>, int):
it discards the first Count items and yields everything after them.
A count of 0 or negative is not an error - the transformer yields the source
unchanged (matches the BCL contract for Enumerable.Skip). When count <= 0
the source is returned directly without a wrapping iterator, so this is essentially free.
Useful for skipping headers, hopping past already-processed rows, or as a building block in composed pipelines when the upstream extractor does not expose a row-skip property.
Implements only Wolfgang.Etl.Abstractions.ITransformAsync<TSource, TDestination> - no progress, no cancellation, no Skip/Max - to keep the hot loop minimal.
Constructors
SkipTransformer(int)
Initializes a new instance that skips the first count items.
public SkipTransformer(int count)
Parameters
countintThe number of items to skip from the start of the source. A value of
0or less yields the source unchanged.
Properties
Count
The number of items this transformer will skip from the start of the source.
public int Count { get; }
Property Value
Methods
TransformAsync(IAsyncEnumerable<T>)
Asynchronously yields all items from items after skipping the first
Count of them.
public IAsyncEnumerable<T> TransformAsync(IAsyncEnumerable<T> items)
Parameters
itemsIAsyncEnumerable<T>The asynchronous source sequence.
Returns
- IAsyncEnumerable<T>
An asynchronous sequence containing the items from
itemsafter position Count. Empty if the source has Count or fewer items. The sourceitemsdirectly when Count is0or negative.
Exceptions
- ArgumentNullException
itemsis null.