首页 > 代码库 > LINQ to JavaScript

LINQ to JavaScript

JSLINQ 是一个将LINQ对象转化为JavaScript对象的工具 。它是构建在JavaScript的数组对象的基础上进行转换的,如果您使用的是一个数组,你可以使用LINQ到javascript 。

示例:

 

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");

官网:http://jslinq.codeplex.com/