2011-02-02 133 views
1

我有2個列表。我應該比較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; 

在 「常用」 字典哪個對象應該我給( 「說文解字通用」)

+0

whoa pal ..這改變了整個問題的範圍... – naveen 2011-02-02 12:14:21

回答