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

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -