【发布时间】:2011-06-19 21:34:43
【问题描述】:
我有 2 个列表。我应该比较这两个列表,并且应该从两个列表中获取公共值,我应该把它放在一个字符串数组中......
第一个列表....
List<string> IDs = new List<string>();
Dictionary<string, Test> group = TestProxy.GetNames(IDs.ToArray());
第二个列表...
List<string> Names = new List<string>();
Dictionary<string, Test> groupNames = TestProxy.GetSections(Names.ToArray());
如何取共同的价值观...
更新代码....
List<string> IDs = new List<string>();
modulesIDs.Add("ID1");
Dictionary<string, Group> group = PrivilegeProxy.GetNames(IDs.ToArray());
List<string> Roles = new List<string>();
Roles.Add("Role1");
Dictionary<string, Role> Role = PrivilegeProxy.GetRoles(Roles.ToArray());
Dictionary<string, "******"> common = group.Intersect(Role).ToDictionary(x => x.Key, x => x.Value);
return common;
在“通用”词典中我应该给出哪个对象(“通用词典”)
【问题讨论】:
-
哇,朋友……这改变了问题的整个范围……
标签: c# linq asp.net-mvc-2