Friday, November 30, 2007

PLINQ

A CTP of “Parallel Extensions to the .NET Framework”  (aka PLINQ) just dropped today.  It’s stuff like this and SyncLinq that really show off the power of these new language features coming from Redmond.  Using one line of code (or less), you can convert code to take advantage of multiple processors:

 

var filteredPeople = (from person in people.AsParallel()

                              where person.Name.StartsWith(“Bob”)

                              select person).ToArray()

 

or convert it to play nicely with databinding UIs:

 

 var bindablePeople = from person in people.ToSyncLinq()

                              where person.Name.StartsWith(“Bob”)

                              select person

 

I haven’t had a chance to do anything with either besides looking at the docs, but clearly this is exciting stuff, and something to keep on your radar.

 

No comments: