示例#1
0
        /// <summary>
        /// Create from tasks
        /// </summary>
        /// <param name="tasks"></param>
        /// <returns></returns>
#pragma warning disable IDE1006 // Naming Styles
        public static async Task <IAsyncDisposable> AsAsyncDisposable(
            this IEnumerable <Task <IAsyncDisposable> > tasks)
        {
#pragma warning restore IDE1006 // Naming Styles
            return(new AsyncDisposable(await AsyncDisposable.WhenAll(tasks)));
        }
示例#2
0
 /// <summary>
 /// Safe waiting for disposables
 /// </summary>
 /// <param name="disposables"></param>
 /// <returns></returns>
 public static Task DisposeAsync(
     this IEnumerable <IAsyncDisposable> disposables)
 {
     return(AsyncDisposable.DisposeAsync(disposables));
 }