C# | Check if an array object is equal to another array object Last Updated : 06 Jan, 2022 Comments Improve Suggest changes Like Article Like Report An array is a group of like-typed variables that are referred to by a common name. And each data item is called an element of the array. Equals(Object) method which is inherited by Array class from object class is used to check whether an array is equal to another array or not. Syntax: public virtual bool Equals (object obj); Here, obj is the object which is to be compared with the current object.Return Value: This method return true if the specified object is equal to the current object otherwise it returns false. Below programs illustrate the use of above-discussed method: Example 1: C# // C# code to check if a Array is // equal to other Array or not using System; namespace geeksforgeeks { class GFG { // Main Method public static void Main() { // Two-dimensional array int[, ] intarray = new int[, ] { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7, 8 } }; // check if intarray is // equal to itself or not Console.WriteLine(intarray.Equals(intarray)); } } } Output: True Example 2: C# // C# code to check if an Array is // equal to other Array or not using System; namespace geeksforgeeks { class GFG { // Main Method public static void Main() { // Creating and initializing new the String String[] arr1 = new String[4] { "Sun", "Mon", "Tue", "Thu" }; // taking anotther array String[] arr2 = new String[4] { "Sun", "Mon", "Tue", "Thu" }; // check if arr1 is // equal to arr2 or not Console.WriteLine(arr1.Equals(arr2)); // assigning arr1 reference to arr3 String[] arr3 = new String[4]; arr3 = arr1; // check if arr2 is // equal to arr3 or not Console.WriteLine(arr2.Equals(arr3)); // check if arr1 is // equal to arr3 or not // it will return true as both // array object refer to same Console.WriteLine(arr1.Equals(arr3)); } } } Output: False False True Note: If the current instance is a reference type, the Equals(Object) method checks for reference equality. Comment More infoAdvertise with us Next Article C# | Check if an array object is equal to another array object K Kirti_Mangal Follow Improve Article Tags : C# CSharp-method CSharp-Arrays Similar Reads C# | Check if two BitArray objects are equal Equals(Object) Method which is inherited from the Object class is used to check if a specified BitArray object is equal to another BitArray object or not. Syntax: public virtual bool Equals (object obj); Here, obj is the object which is to be compared with the current object. Return Value: This meth 2 min read C# | Check if two ArrayList objects are equal Equals(Object) Method which is inherited from the Object class is used to check whether the specified ArrayList object is equal to another ArrayList object or not. Syntax: public virtual bool Equals (object obj); Here, obj is the object which is to be compared with the current object. Return Value: 2 min read C# | Check if two List objects are equal Equals(Object) Method which is inherited from the Object class is used to check if a specified List<T> object is equal to another List<T> object or not. Syntax: public virtual bool Equals (object obj); Here, obj is the object which is to be compared with the current object. Return Value: 2 min read C# | Check if two Tuple Objects are equal A tuple is a data structure which gives you the easiest way to represent a data set. You can also check if the given tuple object is equal to the specified object or not using the Equals Method. This method will return true if the given tuple object is equal to the specified object, otherwise, retur 2 min read C# | Check if two SortedSet<T> objects are equal Equals(Object) Method which is inherited from the Object class is used to check if a specified SortedSet<T> object is equal to another SortedSet<T> object or not. Syntax: public virtual bool Equals (object obj); Here, obj is the object which is to be compared with the current object. Ret 2 min read Like