using System;
namespace CompareTwoArrays
{
class Program
{
static void Main(string[] args)
{
String[] arrayItem1 = {
"dog",
"cat",
"wolf",
"orange"
};
String[] arrayItem2 = {
"fox",
"wolf",
"bear",
"dog",
"banana",
"paper",
"cat"
};
Boolean isMatch = false;
foreach (String itemArray1 in arrayItem1)
{
foreach (String itemArray2 in arrayItem2)
{
if (String.Compare(itemArray1,itemArray2,true)==0)
{
isMatch = true;
Console.WriteLine("Array element {0} in arrayItem1 was found in arrayItem2", itemArray1);
}
}
if (!isMatch)
{
Console.WriteLine("Array element {0} in arrayItem1 was not found in arrayItem2", itemArray1);
}
isMatch = false;
}
Console.Read();
}
}
}
********************************************************************************
No comments:
Post a Comment