c# - How to cancel parallel operation and return a partial list of result? -


i have long parallel operation done on list of data such:

list<filedto> attachmentdtos = msg.attachments.asparallel().select(attachment => downloadattachment(attachment, folder, msg, element, cancellationtokn)).where(x=>x!=null).tolist(); 

in case download list of attachments using asparallel, want able cancel part way. way done returning null when cancellationtoken invoked , filtering list nulls.

is there cleaner way this?


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -