Ejemplo n.º 1
0
 /// <summary>
 /// Converts query results to an <see cref="ListResult{T}"/> object.
 /// </summary>
 /// <typeparam name="TSource">The type of items.</typeparam>
 /// <param name="source">The query to convert.</param>
 /// <param name="cancellationToken">A token to observe while waiting for the task to complete.</param>
 /// <returns>
 /// The task object representing the asynchronous operation.
 /// </returns>
 public static async Task <ListResult <TSource> > ToListResultAsync <TSource>(this IQueryable <TSource> source, CancellationToken cancellationToken)
 {
     return(ListResult.Create(await source.ToArrayAsync(cancellationToken)));
 }