Find out the difference between two sequences number in Linq

Ranjeet_8
Posted by Ranjeet_8 under LINQ category on | Points: 40 | Views : 1462

var number1 = new[] { 1, 3, 5, 6, 7, 8 };
var number2 = new[] { 1, 6, 7, 8 };
var CompareResult = number1.SequenceEqual(number2);

if (!CompareResult )
{
Console.WriteLine("Diff. between two sequence numbers are : ")
var differenceResult = number1.Except(number2);
Array.ForEach(diff.ToArray(), x => Console.WriteLine(x));
}
The output will be : Diff. between two sequence numbers are :
3
5

Comments or Responses

Login to post response