Users Pricing

forum

Home Forums Comparing array values with each other – MindStick

Comparing array values with each other

Manoj Bhatt 2218 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.


1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md