hi ,
i am trying to tally two arrays like myArray{a,b,c} and urArray{a,b,c,c}
i wanted to check if both the elements have same elements ,for example in above condition the second array that is 'urArray' has an extra 'c' .
and the code should be able to equate two sets of array if they have the same elements or not and the order of the elements doesn't matter just that both array should have same elements i.e if one has two 'c' the other should also have two 'c' otherwise the condition is false
so what i did was:
char[] myArray = new char[] {'a','b','c','c'};
char[] urArray = new char[] { 'a', 'b', 'c' ,'a'};
List<char> tmp2 = new List<char>(urArray);
for (int i = 0; i < myArray.Length; ++i)
{
for (int j = 0; j < urArray.Length; ++j)
{
if (myArray[i] == urArray[j])
{
System.Console.WriteLine(urArray[j] + "--> " + "urArray"+" myArray"+"--> "+myArray[i]);
tmp2.Remove(urArray[j]);
urArray = tmp2.ToArray();
}
else if (myArray[i] != urArray[j])
{
System.Console.WriteLine(myArray[i] + "--> " + "myArray" + " urArray" + "--> " + urArray[j]);
}
}
}
but have no idea how to show that if the array have same elements or not ...
how can i accomplish this?