Table of Contents

Method IterateWhile

Namespace
Open.Database.Extensions
Assembly
Open.Database.Extensions.Core.dll

IterateWhile(IDataReader, Func<IDataRecord, bool>, bool, CancellationToken)

Iterates an IDataReader while the predicate returns true.

public static void IterateWhile(this IDataReader reader, Func<IDataRecord, bool> predicate, bool throwOnCancellation, CancellationToken cancellationToken = default)

Parameters

reader IDataReader

The IDataReader to iterate.

predicate Func<IDataRecord, bool>

The handler function that processes each IDataRecord and decides if iteration should continue.

throwOnCancellation bool

If true, when canceled, may exit the iteration via an exception. Otherwise when canceled will simply stop iterating and return without exception.

cancellationToken CancellationToken

An optional cancellation token for stopping the iteration.

IterateWhile(IDataReader, Func<IDataRecord, bool>, CancellationToken)

Iterates an IDataReader while the predicate returns true.

public static void IterateWhile(this IDataReader reader, Func<IDataRecord, bool> predicate, CancellationToken cancellationToken = default)

Parameters

reader IDataReader

The IDataReader to iterate.

predicate Func<IDataRecord, bool>

The handler function that processes each IDataRecord and decides if iteration should continue.

cancellationToken CancellationToken

An optional cancellation token for stopping the iteration.