kendi görevlerini sahip birden TAKS ile WhenAll, ve merak ettim Bu biraz verbose gibi görünüyor ve bunun için daha kısa bir sürüm olup olmadığını merak ediyordum.Görev tüm ı Task.WhenAll için arama yapmak ve her biri kendi alt görevler var Görevler bir dizi beklemek istiyorum
public async Task ChangeNotificationsDispatchTimeAsync(string userId, DateTime utcDateTimeToSend)
{
IList<TNotificationEntity> notifications =
await _notificationsTable.GetRowsByPartitionKeyAndRowKeyAsync(ToTicks(_now), userId, QueryComparisons.GreaterThanOrEqual);
await Task.WhenAll(
notifications.Select(notification =>
{
return new Task(() =>
{
_notificationsTable.DeleteRowAsync(notification.PartitionKey, notification.RowKey);
notification.PartitionKey = ToTicks(utcDateTimeToSend);
_notificationsTable.InsertRowAsync(notification);
});
}));
}