LINQ是.NET3.X的一个很重要的新特性,它的内容非常之广,这里只为了说明其是.NET3.x的新特性来举一个很简单的例子:
Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication1
{
public partial class LinQ : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string[] Group3 = new string[] { "shangyufeng", "zhaojinyu", "qiujuan" };
var result = from x in Group3
where x.StartsWith("z")
select x;
List<string> member = result.ToList();
Response.Write(member[0].ToString());
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication1
{
public partial class LinQ : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string[] Group3 = new string[] { "shangyufeng", "zhaojinyu", "qiujuan" };
var result = from x in Group3
where x.StartsWith("z")
select x;
List<string> member = result.ToList();
Response.Write(member[0].ToString());
}
}
}