Javatpoint Logo
Javatpoint Logo

LINQ SequenceEqual Method

In LINQ, the SequenceEqual method is used to compare the sequence of two collections that are equal or not. It determines two sequences whether they are equal or not by comparing the elements in a pair-wise manner, and two sequences contain the equality number of the element or not.

The LINQ SequenceEqual method will return the Boolean value true in case two sequence elements are equal, and all the elements match in both the sequences; otherwise, it will throw false.

Syntax of LINQ SequenceEqual Method

The syntax of using LINQ SequenceEqual method to check the given two collections are equal or not.

In the above syntax, we are using the LINQ SequenceEqual method to check whether "arr1" and "arr2" are equal or not.

Example of LINQ SequenceEqual Method

Here is the example of the LINQ SequenceEqual Method to check the equality of two sequences.

In the above example, we are comparing two collections using the SequenceEqual method to check if both the sequences are equal or not. Here we used another property "OrdinalIgnoreCase" along with the SequenceEqual method to overcome the problem of case sensitivity. The SequenceEqual treats the "NOIDA" and "noida" as two different elements because of case sensitiveness.

OUTPUT:

LINQ SequenceEqual() Method
Next TopicLINQ Concat Method




Help Others, Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA