可能重复:
How to match two arrays
我有2个阵列
<=> A = [好,坏,猫,青蛙]我希望在两个数组之间进行匹配
结果
[good:best,great]
[坏:生病,邪恶,邪恶,腐烂,恶毒,贫穷,讨厌]
[猫:puss]
[青蛙:蟾蜍,围场]
答案 0 :(得分:0)
试试这个,
string[] roles = {"a", "e", "f", "h"};
string[] allRoles = {"a", "b", "c", "d", "e", "f", "g", "h", "i"};
foreach (string nextRole in allRoles) {
if(Array.IndexOf(roles, nextRole) != -1)
{
Response.Write(nextRole + "<br/>");
}
}