LINQ嵌套的操作是什么呢?LINQ嵌套需要注意什么呢?LINQ嵌套使用的是什么方法呢?那么这里我们通过一个实例向你介绍具体的过程和涉及到的方法。
LINQ嵌套实例实现:
- protected void Page_Load(object sender, EventArgs e)
- {
- var customer = new[]{
- new {PKId="001",Name="admin",Pwd="123456",Group="001"},
- new {PKId="002",Name="user",Pwd="user",Group="003"},
- new {PKId="003",Name="geust",Pwd="guest",Group="004"},
- new {PKId="004",Name="aa",Pwd="123456",Group="002"},
- new {PKId="005",Name="bb",Pwd="123456",Group="002"},
- new {PKId="006",Name="cc",Pwd="123456",Group="002"},
- };
- var groups = new[] {
- new { PKId = "001", depict = "***权限" },
- new {PKId="002",depict="管理员"},
- new {PKId="003",depict="发布信息"},
- new {PKId="004",depict="只有浏览权限"}
- };
- GridView1.DataSource =
- from word2 in groups
- where word2.depict == "管理员"
- select new {
- quanxian = word2.depict,
- Name =
- from word in customer
- where word.Group==word.PKId
- select word
- };
- GridView1.DataBind();
- }
LINQ嵌套的相关实现就向你介绍到这里,希望对你了解和学习LINQ嵌套有所帮助。
【编辑推荐】