What is the default behavior of value type Equals()?
If the current instance is a value type, the Equals(Object) method tests for value equality. Value equality means the following:
The two objects are of the same type. As the following example shows, a Byte object that has a value of 12 does not equal an Int32 object that has a value of 12, because the two objects have different run-time types.
using System;
public class Example
{
public static void Main()
{
byte value1 = 12;
int value2 = 12;
object object1 = value1;
object object2 = value2;
Console.WriteLine("{0} ({1}) = {2} ({3}): {4}",
object1, object1.GetType().Name,
object2, object2.GetType().Name,
object1.Equals(object2));
}
}
// The example displays the following output:
//