forum

home / developersection / forums / comparing array values with each other

Comparing array values with each other

Manoj Bhatt 2067 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
Manoj Bhatt

Other


Message
Can you answer this question?

Answer

1 Answers

Liked By