how to match 2 arrays ironpython or c# [duplicate]
Possible Duplicate:
How to match two arrays
I have 2 arrays
A = [good开发者_如何学Go, bad, cat, frog]
and B = [best, great, ill, evil, wicked, rotten, vicious, poor, nasty, puss, toad, paddock]and I want to match between 2 arrays
Result
[good : best, great] [bad : ill, evil, wicked, rotten, vicious, poor, nasty] [cat : puss] [frog : toad, paddock]Try this,
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/>");
}
}
精彩评论