Exemplo n.º 1
0
 /// <summary>
 ///     Handle the first event on this stream and then automatically unregister.
 /// </summary>
 /// <typeparam name="T">The type of the stream.</typeparam>
 /// <typeparam name="TResult">The type of the result of the task.</typeparam>
 /// <param name="s">The stream.</param>
 /// <param name="modifyTask">A function to modify the task produced by this method.</param>
 /// <param name="token">The cancellation token.</param>
 /// <returns>A task which completes when a value is fired by this stream.</returns>
 public static TaskWithListener <TResult> ListenOnceAsync <T, TResult>(
     this Stream <T> s,
     Func <Task <T>, Task <TResult> > modifyTask,
     CancellationToken token) =>
 s.ListenOnceAsyncInternal((t, l) => new TaskWithListener <TResult>(modifyTask(t), l), token);