Check if two enums are equal or not in C# Last Updated : 28 May, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report Enum.Equals(Object) Method is used to check whether the current instance is equal to a specified object or not. This method overrides ValueType.Equals(Object) to define how enumeration members are evaluated for equality. Syntax: public override bool Equals (object obj); Here, obj is an object to compare with the current instance, or null. Returns: This method returns true if obj is an enumeration value of the same type and with the same underlying value as current instance otherwise, false. Example: csharp // C# program to illustrate the // Enum.Equals(Object) Method using System; class GFG { // taking two enums enum Clothes { Jeans, Shirt } ; enum Colors { Blue, Black } ; // Main Method public static void Main() { Clothes cl1 = Clothes.Jeans; Clothes cl2 = Clothes.Shirt; Colors c1 = Colors.Blue; Colors c2 = Colors.Black; Colors c3 = Colors.Blue; // using the method Console.WriteLine(c1.Equals(c3)); Console.WriteLine(c1.Equals(c2)); Console.WriteLine(cl1.Equals(cl2)); } } Output: True False False Reference: https://docs.microsoft.com/en-us/dotnet/api/system.enum.equals?view=netframework-4.8 Comment More infoAdvertise with us Next Article Check if two enums are equal or not in C# A ankita_saini Follow Improve Article Tags : C# CSharp-method Similar Reads 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 Check if Two Dictionary Objects are Equal in C# In C#, a Dictionary<TKey, TValue> is a collection of key-value pairs. When we work with dictionaries, we may need to check if two dictionaries are equal. This means they contain the exact same keys and values.In this article, we are going to learn how to check dictionary equality both by refer 3 min read Check if the given ranges are equal or not in C# The Range Structure is introduced in C# 8.0. It represents a range that has a start and end indexes. You are allowed to check the given ranges are equal or not with the help of following methods provided by the Range struct: 1. Equals(Object): This method is Object Class method which returns a value 2 min read Checking the Given Indexes are Equal or not in C# The Index Structure is introduced in C# 8.0. It represents a type that can be used to index a collection or sequence and it can be started from the start or the end. You are allowed to compare two indexes with each to check whether they are equal or not with the help of the following methods(Equal M 3 min read Checking if two ValueTuple<T1> are equal or not in C# ValueTuple is a structure introduced in C# 7.0 which represents the value type Tuple. It is already included in .NET Framework 4.7 or higher version. It allows you to store a data set that contains multiple values that may or may not be related to each other. In ValueTuple<T1>, you can check i 3 min read Like