- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to compare two arrays in C#?
Firstly, set the two arrays to be compared −
// two arrays int[] arr = new int[] { 99, 87, 56, 45}; int[] brr = new int[] { 99, 87, 56, 45 };
Now, use SequenceEqual() to compare the two arrays −
arr.SequenceEqual(brr);
The following is the code to compare two arrays −
Example
using System; using System.Linq; namespace Demo { class Program { static void Main(string[] args) { // two arrays int[] arr = new int[] { 99, 87, 56, 45}; int[] brr = new int[] { 99, 87, 56, 45 }; // compare Console.WriteLine(arr.SequenceEqual(brr)); } } }
- Related Articles
- How to compare two arrays in Java?
- How do we compare two arrays in Java?
- Compare Two Java long Arrays
- Compare Two Java double arrays
- Java Program to compare two Boolean Arrays
- Java Program to compare two Byte Arrays
- How to compare arrays in Java
- How to compare arrays in JavaScript?
- Compare Two Java int Arrays in Java
- Java Program to compare Two Java short Arrays
- Java Program to compare two Java char Arrays
- Java Program to compare Two Java float Arrays
- How to compare two Dates in C#?
- How to compare two dictionaries in C#?
- How to compare two tuples in C#?

Advertisements