コード例 #1
0
 /// <summary>
 ///     Handle the first event on this stream and then automatically unregister.
 /// </summary>
 /// <typeparam name="T">The type of the stream.</typeparam>
 /// <param name="s">The stream.</param>
 /// <returns>A task which completes when a value is fired by this stream.</returns>
 public static TaskWithListener <T> ListenOnceAsync <T>(this Stream <T> s) => s.ListenOnceAsync(CancellationToken.None);
コード例 #2
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>
 /// <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) =>
 s.ListenOnceAsync(modifyTask, CancellationToken.None);