Use SequenceEqual Operator to compare a string array with itself in CSharp

Description

The following code shows how to use SequenceEqual Operator to compare a string array with itself.

Example


/*from  w  w w. ja v a2s  .c  om*/
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

public class MainClass {
    public static void Main() {
        string[] presidents = {"HTML", "HTML5", "CSS", "CSS3", "Javascript", "C#"};

        bool eq = presidents.SequenceEqual(presidents);
        Console.WriteLine(eq);

    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    LINQ »




Operator
Select
Where
OrderBy
Group
Join
Let
LINQ