Define the query using PLINQ

Jitendrasoft09
Posted by Jitendrasoft09 under C# category on | Points: 40 | Views : 687
using System;
using System.Collections.Generic;
using System.Linq;

class jkexample {

static void Main(string[] args) {

string[] myobject = new string[] { "bca","mca", "dca", "adca" };



var paralleldata = from e in myobject.AsParallel()
where e[0] == 'p'
select new {
Name = e,
Length = e.Length
};



foreach (var item in paralleldata) {
Console.WriteLine("Name: {0}, Length: {1}",
item.Name, item.Length);
}

Console.ReadLine();
}
}

Comments or Responses

Login to post response