Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do C# 7 ValueTuples implement the Equals method but not the double equals operator?

Tags:

Consider the following code snippet:

var tuple1 = (7, "foo"); var tuple2 = (7, "foo"); var tuple3 = (42, "bar");  Assert.That(tuple1.Equals(tuple2), Is.True);    //This passes Assert.That(tuple1.Equals(tuple3), Is.False);   //This passes  Assert.That(tuple1 == tuple2, Is.True);         //This does not compile 

The first two asserts pass. The third one does not compile.

Why does the ValueTuple implement a custom Equals method but not implement the double equals operator?