Exemplo n.º 1
0
 /// <summary>Returns an array containing all the items in the sequence</summary>
 public async static Task <T[]> ToArrayAsync <T>(this IAsyncEnumerator <T> source, CancellationToken cancellationToken = default(CancellationToken))
 {
     return((await source.ToListAsync(cancellationToken)).ToArray());
 }
Exemplo n.º 2
0
 /// <summary>
 /// Converts the collection to a list
 /// </summary>
 /// <typeparam name="TValType">value type of the collection</typeparam>
 /// <param name="enumerator">enumerator to convert</param>
 /// <param name="tx">tx to enforce that this is called in a transactional context</param>
 /// <returns>a list containing all elements in the origin collection</returns>
 public static Task <IList <TValType> > ToListAsync <TValType>(
     this IAsyncEnumerator <TValType> enumerator, ITransaction tx)
 {
     return(enumerator.ToListAsync(CancellationToken.None, tx));
 }