The AsEnumerable operator converts a ParallelQuery<T> into an IEnumerable<T> and so forces sequential query execution.
public static IEnumerable<T> AsSequential<T>( this ParallelQuery<T> source )
using System; using System.Linq; using System.Collections; using System.Collections.Generic; class Program/*from www .j a v a 2s. c om*/ { static void Main(string[] args) { string[] codeNames = {"Python", "Java", "Javascript", "Bash", "C++", "Oracle"}; IEnumerable<string> results = codeNames .AsParallel() .AsOrdered() .Where(p => p.Contains('o')) .Take(5) .AsEnumerable() .Where(p => p.Contains('e')) .Select(p => p); foreach (string president in results) { Console.WriteLine("Match: {0}", president); } } }