Enum.Equals Method (Object)
Returns a value indicating whether this instance is equal to a specified object.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- obj
-
Type:
System.Object
An object to compare with this instance, or null.
Return Value
Type: System.Booleantrue if obj is an enumeration value of the same type and with the same underlying value as this instance; otherwise, false.
The Enum.Equals(Object) method overrides ValueType.Equals(Object) to define how enumeration members are evaluated for equality.
The following example defines two enumeration types, SledDog and WorkDog. The SledDog enumeration has two members, SledDog.AlaskanMalamute and SledDog.Malamute, that have the same underlying value. The call to the Equals method indicates that these values are equal because their underlying values are the same. The SledDog.Malamute and WorkDog.Newfoundland members have the same underlying value, although they represent different enumeration types. A call to the Equals method indicates that these values are not equal.
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1