question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Right.Equals returns false for equal anonymous values

See original GitHub issue
var i1 = Right(1);
var i2 = Right(1);
Console.WriteLine(i1.Equals(i2));   // True

var a1 = new { x = 1 };
var a2 = new { x = 1 };
Console.WriteLine(a1.Equals(a2));   // True

var r1 = Right(a1);
var r2 = Right(a2);
Console.WriteLine(r1.Equals(r2));   // False

Shouldn’t the last comparison be true as well?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
TysonMNcommented, Nov 15, 2019

You are right. That test does not pass for me. Somehow I got confused and thought that it passed for me.

0reactions
louthycommented, Nov 25, 2019

Fixed in 3.3.40

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Why does Object.Equals() return false for identical ...
The first line of the Equals method checks whether value is an instance of AnonymousType<TName, TValue> , referring specifically to the class ...
Read more >
In Java, is it possible for equals (==) to return false even if ...
For any object it is possible to return false. ... We must always use equals() function as it checks whether the values of...
Read more >
Overriding equals() and hashCode() method in Java ...
@Anonymous, As per equals and hashcode contract, equals() method should return false if compared with null and also if two object are not...
Read more >
How to Write an Equality Method in Java
Class java.lang.Object defines an equals method, which subclasses may override. Unfortunately, it turns out that writing a correct equality ...
Read more >
Anonymous Types
Using anonymous types causes a smaller amount of data to be returned in the query. If you don't specify member names in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found