码迷,mamicode.com
首页 > Windows程序 > 详细

C# LINQ

时间:2015-03-02 18:22:43      阅读:186      评论:0      收藏:0      [点我收藏+]

标签:

DataTable Detail = EditData.Tables[dt_MyUserRole._TableName].Copy();
           Detail.AcceptChanges();
           var enumTable = from d1 in dtRoleAuthority.AsEnumerable()
                           join d2 in Detail.AsEnumerable()
                           on d1.Field<string>(dt_MyRole.RoleID) equals
                              d2.Field<string>(dt_MyUserRole.RoleID)
                           select new
                           {
                               RoldID = d1.Field<string>(dt_MyRoleAuthority.RoleID),
                               FullName = d1.Field<string>(dt_MyRoleAuthority.FullName),
                               Authority = d1.Field<int>(dt_MyRoleAuthority.Authority),
                               PKey = d1.Field<string>(dt_MyRoleAuthority.FullName) + "." + d1.Field<int>(dt_MyRoleAuthority.Authority)
                           };
           TreeListNode node;
           foreach (var v in enumTable)
           {
               node = tree_Module.FindNodeByKeyID(v.PKey);
               if (node != null)
                   _TreeListInitial.SetNodeCheckState(node, CheckState.Checked);
           }

C# LINQ

标签:

原文地址:http://www.cnblogs.com/GarsonZhang/p/4309081.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!