
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
C# program to check whether two sequences are the same or not
The SequenceEqual method is used to test collections for equality.
Set sequences −
string[] arr1 = { "This", "is", "it" }; string[] arr2 = { "My", "work", "report" }; string[] arr3 = { "This", "is", "it" };
Now, use the SequenceEquals methods to check whether sequences are same or not −
arr1.SequenceEqual(arr2);
The following is an example −
Example
using System; using System.Linq; class Program { static void Main() { string[] arr1 = { "This", "is", "it" }; string[] arr2 = { "My", "work", "report" }; string[] arr3 = { "This", "is", "it" }; bool res1 = arr1.SequenceEqual(arr2); Console.WriteLine(res1); bool res2 = arr1.SequenceEqual(arr3); Console.WriteLine(res2); } }
Output
False True
- Related Articles
- Program to check whether leaves sequences are same of two leaves or not in python
- C Program to check if two strings are same or not
- Golang Program to Check Whether Two Matrices are Equal or Not
- Swift Program to Check Whether Two Matrices Are Equal or Not
- Java Program to check whether two Strings are an anagram or not.
- Program to check whether two sentences are similar or not in Python
- Program to check whether all leaves are at same level or not in Python
- Program to check whether two string arrays are equivalent or not in Python
- Program to check given push pop sequences are proper or not in python
- C# Program to check whether a directory exists or not
- Check whether two schedules are view equal or not(DBMS)
- Program to check whether parentheses are balanced or not in Python
- Program to check whether given words are maintaining given pattern or not in C++
- C# program to check whether a list is empty or not
- C++ Program to Check Whether a Number is Prime or Not

Advertisements