Method ToListAsync
ToListAsync(IResultCursor, int, CancellationToken)
Pull all records in the result stream into memory and return in a list.
public static Task<List<IRecord>> ToListAsync(this IResultCursor result, int initialCapacity = 0, CancellationToken cancellationToken = default)
Parameters
result
IResultCursorThe result stream.
initialCapacity
intOptional, the driver has no knowledge of the expected result size so use the default List<T> constructor: List(). a capacity can be provided to cost of extending this list.
cancellationToken
CancellationTokenA cancellation token that can be used to cancel the asynchronous operation.
Returns
ToListAsync(IResultCursor, CancellationToken)
Pull all records in the result stream into memory and return in a list.
public static Task<List<IRecord>> ToListAsync(this IResultCursor result, CancellationToken cancellationToken)
Parameters
result
IResultCursorThe result stream.
cancellationToken
CancellationTokenA cancellation token that can be used to cancel the asynchronous operation.
Returns
ToListAsync<T>(IResultCursor, Func<IRecord, T>, int)
Apply the operation on each record in the result stream and return the operation results in a list.
public static Task<List<T>> ToListAsync<T>(this IResultCursor result, Func<IRecord, T> operation, int initialCapacity = 0)
Parameters
result
IResultCursorThe result stream.
operation
Func<IRecord, T>The operation to carry out on each record.
initialCapacity
intOptional, the driver has no knowledge of the expected result size so use the default List<T> constructor: List(). a capacity can be provided to cost of extending this list.
Returns
Type Parameters
T
The return type of the list