Table of Contents

Method ToListAsync

Namespace
Neo4j.Driver
Assembly
Neo4j.Driver.dll

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 IResultCursor

The result stream.

initialCapacity int

Optional, 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 CancellationToken

A cancellation token that can be used to cancel the asynchronous operation.

Returns

Task<List<IRecord>>

A list with all records in the result stream.

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 IResultCursor

The result stream.

cancellationToken CancellationToken

A cancellation token that can be used to cancel the asynchronous operation.

Returns

Task<List<IRecord>>

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 IResultCursor

The result stream.

operation Func<IRecord, T>

The operation to carry out on each record.

initialCapacity int

Optional, 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

Task<List<T>>

A list of collected operation result.

Type Parameters

T

The return type of the list