Now, what if the order of our results matters? In a lot of cases, we will want the results to come back in a certain order. Let's examine how we can accomplish this.
There are several methods contained in the parallel extension methods of the
IEnumerable interface. The two we use the most are
AsOrderedBy(). These two methods guarantee order preservation in the results of the parallel query. This does add some cost and overhead.
Let's take our project from the last section and update it to return the ordered results.
Let's open up our
PLINQQuery project and make the following changes:
btnMethod1_Clickmethod to look like the following by adding the