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/*  www  . j  ava2  s.c  o m*/
{
    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