forum

Home / DeveloperSection / Forums / Comparing array values with each other

Comparing array values with each other

Manoj Bhatt 1814 19-Aug-2014

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.


c# c# 
Updated on 19-Aug-2014

Can you answer this question?


Answer

1 Answers

Liked By