CSharp - Parallel LINQ Introduction

Introduction

Parallel LINQ, known as PLINQ, processes the objects in the source enumeration concurrently.

Demo

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

class Program//from  w ww  .  j a va 2s.c o  m
{
    static void Main(string[] args)
    {
        string[] codeNames = {
              "Python", "Java", "Javascript", "Bash", "C++", "Oracle"};

        string president = codeNames.AsParallel()
            .Where(p => p.StartsWith("J")).First();
            
        Console.WriteLine(president);
    }
}

Result

Related Topics