hye everyone i have some problem with coding. The problem is i have two data which is need to be compared for matching item and there is some of the data have duplicates and i did not want to remove the duplications, the part of the data is divided by an empty space. What i need is to compare the data symmetricaly.
The test data is like this:-
Data 1:
A
B
C
D
Data 2:
A
Q
C
B
C
D
the result suppose to be :
A is match
Q is not match
C is not match
B is match
C is match
D is match
what i get for the result is :
A is match
Q is not match
C is match
B is match
C is match
D is match
bool found = false;
foreach (string str in list2.ToList())
{
foreach (string str2 in list.ToList())
{
if(!str2.Equals(""))
{
if (str.Equals(str2))
{
found = true;
listBox1.Items.Add(str2 + " and " + str + " MATCH ");
break;
}
}
else
{
if (str.Equals(""))
found = false;
}
}
if (!str.Equals(""))
{
if (found == false)
{
listBox1.Items.Add(str + " NOT MATCH ");
}
}
else
listBox1.Items.Add("");
found = false;
}