string[] Array1 = { "Vinay", "Pradeep", "Manoj", "Nimesh", "Sandy", "Viren", "Suresh" };
string[] Array2 = { "Vinay", "Pradeep", "Manoj", "Nimesh", "Sandy" };
foreach (string nextRole in Array1)
{
int position = Array.IndexOf(Array2, nextRole);
if (position < 0) // change it to > if u want common values from both arrays)
{
Response.Write(nextRole + "<br/>");
}
}
========================
Output:
Viren
Suresh
===============
string[] Array2 = { "Vinay", "Pradeep", "Manoj", "Nimesh", "Sandy" };
foreach (string nextRole in Array1)
{
int position = Array.IndexOf(Array2, nextRole);
if (position < 0) // change it to > if u want common values from both arrays)
{
Response.Write(nextRole + "<br/>");
}
}
========================
Output:
Viren
Suresh
===============
No comments:
Post a Comment