Class SkipTakeIteratorBase<T>

Version: 3.4

Base implementation for Query iterators.

Inheritance
object
SkipTakeIteratorBase<T>
Namespace: StylelabsStylelabs.MSdkStylelabs.M.Sdk.ModelsQuerying
Assembly: Stylelabs.M.Sdk.dll
Syntax
RequestResponse
public abstract class SkipTakeIteratorBase<T> : IQueryIterator<T>, IIterator where T : class, IQueryResult
Type Parameters
NameDescription
T

The type result returned by the iterator.

Constructors

SkipTakeIteratorBase(T)

Initializes a new instance of the SkipTakeIteratorBase<T> class and continues iterating from the specified result on.

Declaration
RequestResponse
protected SkipTakeIteratorBase(T result)
Parameters
TypeNameDescription
Tresult

The result to start iterating from.

SkipTakeIteratorBase(long)

Initializes a new instance of the SkipTakeIteratorBase<T> class.

Declaration
RequestResponse
protected SkipTakeIteratorBase(long pageSize)
Parameters
TypeNameDescription
longpageSize

The size of the page.

Properties

Current

Gets get the current result during iteration.

Declaration
RequestResponse
public T Current { get; }
Property Value
TypeDescription
T

Methods

CanMoveNext()

Checks if the iterator can move further through the results.

Declaration
RequestResponse
public bool CanMoveNext()
Returns
TypeDescription
bool

true if there more results.

CanMovePrevious()

Checks if the iterator can move backwards through the results.

Declaration
RequestResponse
public bool CanMovePrevious()
Returns
TypeDescription
bool

true if there move backwards.

GetResultAsync(long, long)

Gets results.

Declaration
RequestResponse
protected abstract Task<T> GetResultAsync(long skip, long take)
Parameters
TypeNameDescription
longskip

How many items to skip.

longtake

How many items to take.

Returns
TypeDescription
Task<>

The results.

MoveNextAsync()

Advances the enumerator to the next page/batch of the collection. The result will be available in Current.

Declaration
RequestResponse
public Task<bool> MoveNextAsync()
Returns
TypeDescription
Task<>bool

true if the enumerator was successfully advanced to the next page; false if the enumerator has passed the end of the collection.

MovePreviousAsync()

Moves the enumerator backwards, to the previous page/batch of the collection. The result will be available in Current.

Declaration
RequestResponse
public Task<bool> MovePreviousAsync()
Returns
TypeDescription
Task<>bool

true if the enumerator was successfully advanced to the previous page; false if the enumerator has passed the start of the collection.

Reset()

Resets the iterator to start before the first result again.

Declaration
RequestResponse
public void Reset()

Explicit Interface Implementations

IIterator.Current

Gets the current result. This is initially null. Use MoveNextAsync() first.

Declaration
RequestResponse
object IIterator.Current { get; }
Returns
TypeDescription
object

Implements

Do you have some feedback for us?

If you have suggestions for improving this article,