CSharp - Use PLINQ Query Where the Results Ordering Is Not Important

Description

Use PLINQ Query Where the Results Ordering Is Not Important

Demo

using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

class Program/*from   w  w w .  ja  v  a 2s . c  om*/
{
    static void Main(string[] args)
    {
        string[] codeNames = {"Python", "Java", "Javascript", "Bash", "C++", "Oracle"};
        
        int count = codeNames.AsParallel()
            .Where(p => p.Contains("o"))
            .Select(p => p)
            .Count();
        
        Console.WriteLine("Result count: {0}", count);
    }
}

Result

Related Topic