Saturday, November 08, 2008

LINQ to JavaScript - Home

LINQ to JavaScript - Home: "LINQ to JavaScript (JSLINQ for short) is an implementation of LINQ to Objects implemented in JavaScript. It is built using a set of extension methods built on top of the JavaScript Array object. If you are using an Array, you can use JSLINQ.


If you don't know what LINQ is; it's a new featureset in the .NET Framework 3.5 that allows more SQL-like querying of any kind of data. In the case of LINQ to JavaScript, it provides the ability to query against Arrays.

Example Usage
var myList = [             {FirstName:"Chris",LastName:"Pearson"},             {FirstName:"Kate",LastName:"Johnson"},             {FirstName:"Josh",LastName:"Sutherland"},             {FirstName:"John",LastName:"Ronald"},             {FirstName:"Steve",LastName:"Pinkerton"}             ];              var exampleArray = From(myList).                    Where("item.FirstName == 'Chris'").                    OrderBy("item.FirstName").                    Select("item.FirstName");

No comments: