Differences between linq and plinq

What is the difference between the two?

What is the best way to compare?

Always better than plinq?

When do we use plinq?

+5
source share
4 answers

Linq is a set of technologies that work together to solve a similar family of problems. In all of them, you have a data source (xml file or files, the contents of the database, a collection of objects in memory), and you want to get some or all of this data and act on it somehow. Linq works on the commonality of this many tasks, such that:

var brithdays = from user in users where
  user.dob.Date == DateTime.Today && user.ReceiveMails
  select new{user.Firstname, user.Lastname, user.Email};
foreach(bdUser in birthdays)
  SendBirthdayMail(bdUser.Firstname, bdUser.Lastname, bdUser.Email);

And the equivalent (explicit use of Linq-related classes and methods with traditional C # syntax):

var birthdays = users
  .Where(user => user.dob.Date == DateTime.Today)
  .Select(user => new{user.Firstname, user.Lastname, user.Email});
foreach(bdUser in birthdays)
  SendBirthdayMail(bdUser.Firstname, bdUser.Lastname, bdUser.Email);

, , , XML- .

, users. , , linq-to-objects, System.Data.Linq.Table, linq sql. , SQL-, .

ParallelQuery - .AsParallel - -memroy, ( ), - , ​​ .

, - . , .

.

-, , , , . , .

-, . , 4- , 4- (4 , , , 8 , ). , ​​(, - "-" ), . - , , .

-, - (, ) , , ..

-, , , , , .

-, , (, - - ), . , , , , 16 , . , .

- , , .

+8

PLinq - Linq. , PLinq .

, . , PLinq - , , .

MSDN .

+2

, AsParallel LINQ, : " Microsoft PLINQ ?"

. -, , PLINQ , - , . LINQ to Objects , , , .

:

PLINQ ( ) LINQ .

, :

Take, TakeWhile, Skip SkipWhile Select, SelectMany ElementAt ( , , Where). , , .

, , , :

, GroupBy, GroupJoin, Distinct, Union, Intersect , , , - PLINQ .

PLINQ LINQ . , , LINQ, , , , . , , : " LINQ?" ( , LINQ .)

PLINQ . , - (. " " " -" ).

PLINQ , . Parallel parallelism . (, , ForAll. , LINQ.)

+2

PLINQ, Threading in #, by Joe Albahari:

( , , ) .

(...)

( ), - .

0

All Articles