in Education by
I have a piece of code which is using Parallel.ForEach, probably based on a old version of Rx extensions or the Tasks Parallel Library. I installed a current version of Rx extensions but cannot find Parallel.ForEach. I'm not using any other fancy stuff of the library and just want to process some data in parallel like this: Parallel.ForEach(records, ProcessRecord); I found this question, but I would not like to depend on an old versions of Rx. But I was not able to find something similar for Rx, so what's the current and most straight forward way to do that using a current Rx version? The project is using .NET 3.5. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
No need to do all this silly goosery if you have Rx: records.ToObservable() .SelectMany(x => Observable.Start(() => ProcessRecord(x), Scheduler.ThreadPoolScheduler)) .ToList() .First(); (Or, if you want the order of the items maintained at the cost of efficiency): records.ToObservable() .Select(x => Observable.Start(() => ProcessRecord(x), Scheduler.ThreadPoolScheduler)) .Concat() .ToList() .First(); Or if you want to limit how many items at the same time: records.ToObservable() .Select(x => Observable.Defer(() => Observable.Start(() => ProcessRecord(x), Scheduler.ThreadPoolScheduler))) .Merge(5 /* at a time */) .ToList() .First();

Related questions

0 votes
    I have a variable, in which is a XML string. In this XML string, I want iterate through a ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 24, 2022 in Education by JackTerrance
0 votes
    How to solve array problem? $kuponlar = $core->query("SELECT * FROM kupon WHERE kupon_durum = ?", ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 14, 2022 in Education by JackTerrance
0 votes
    How to solve array problem? $kuponlar = $core->query("SELECT * FROM kupon WHERE kupon_durum = ?", ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 13, 2022 in Education by JackTerrance
0 votes
    I am working on spark project using Scala. I need to print each element of a list named 'c' ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 9, 2022 in Education by JackTerrance
0 votes
    const navLink = document.querySelectorAll(".nav-link"); navLink.forEach((link) => link.addEventListener(" ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 5, 2022 in Education by JackTerrance
0 votes
    const navLink = document.querySelectorAll(".nav-link"); navLink.forEach((link) => link.addEventListener(" ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 5, 2022 in Education by JackTerrance
0 votes
    const navLink = document.querySelectorAll(".nav-link"); navLink.forEach((link) => link.addEventListener(" ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 2, 2022 in Education by JackTerrance
0 votes
    I've a lookup activity with gets value from a container within a blob. I have a foreach activity which is ... : data.speed> 500 Select the correct answer from above options...
asked Feb 4, 2022 in Education by JackTerrance
0 votes
    How will you print 10 random numbers using forEach of java 8 ?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    What is the purpose of forEach method of stream in Java 8?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    I've built my own CMS for learning purposes (and also just for fun), but now I would like to ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 10, 2022 in Education by JackTerrance
0 votes
    I need a standard deviation function in SQLite. I have found one here: http://www.sqlite.org/contrib ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
...