예제 #1
0
 public static async Task AddAsync <T>(this ICollectionAdder <T> collection, IEnumerable <T> items, CancellationToken token = default)
 {
     if (items?.Any() == true)
     {
         await collection.Add(items, (_, __, ex) => throw ex, token);
     }
 }
예제 #2
0
        public static async Task AddWithResume <T>(this ICollectionAdder <T> collection, IEnumerable <T> items, CancellationToken token = default)
        {
            if (items?.Any() != true)
            {
                return;
            }

            await collection.Add(items, (_, __, ex) => new Failure <T, Exception>(ex), token);
        }
예제 #3
0
 public static void Add <T>(this ICollectionAdder <T> collection, params T[] items)
 {
     collection.Add((IEnumerable <T>)items);
 }
예제 #4
0
 public static void Add <T>(this ICollectionAdder <T> collection, IEnumerable <T> items, CancellationToken token = default)
 {
     collection.AddAsync(items, token).RunSynchronously();
 }