Comparing array values with each other
I want to compare two integer arrays and then print the equals out. I tried the Intersect method:
var checkingDuplicates = boughttickets.Intersect(winningtickets).Any();
and then used a if-statement:
if (checkingDuplicates == false)
{
Console.WriteLine("Sorry, You didn't win anything");
}
else
{
Console.WriteLine(checkingDuplicates);
}
However, the output always returns true with this if-statement.
Pravesh Singh
19-Aug-2014First i would say read the documentation. From your comment above, you can not call .toString() on IEnumerable withou defining .tostring implementation. Try this