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
readerIDataReaderThe IDataReader to iterate.
predicateFunc<IDataRecord, bool>The handler function that processes each IDataRecord and decides if iteration should continue.
throwOnCancellationboolIf true, when canceled, may exit the iteration via an exception. Otherwise when canceled will simply stop iterating and return without exception.
cancellationTokenCancellationTokenAn 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
readerIDataReaderThe IDataReader to iterate.
predicateFunc<IDataRecord, bool>The handler function that processes each IDataRecord and decides if iteration should continue.
cancellationTokenCancellationTokenAn optional cancellation token for stopping the iteration.