Top "Equality" questions

Equality is a relationship between two or more items or variables or objects that exists if (1) the items are the same item, variable, or object or (2) the items are different items, variables or objects but they have the same value.

What is "Best Practice" For Comparing Two Instances of a Reference Type?

I came across this recently, up until now I have been happily overriding the equality operator (==) and/or Equals method …

c# .net comparison operator-overloading equality
Testing anonymous function equality with Jest

Is there a way to test anonymous function equality with jest@20? I am trying to pass a test similar to: …

javascript node.js unit-testing jestjs equality
PHP: Testing whether three variables are equal

I've never come across this before, but how would you test whether three variables are the same? The following, obviously …

php variables equality
Using an equality check between columns in a SELECT clause

I am using Microsoft SQL Server 2012 and I would like to run this seemingly simple query: SELECT FirstEvent.id AS …

sql sql-server select equality
Is it possible to define equality for named types/structs?

After reading a related question about using slices in maps, I became curious about equality in Go. I know it's …

types struct go equality
Scala class and case class == comparison

I don't quite understand why when we compare two instance with the same properties of a class without overriding the …

scala equality
Are == and != mutually dependent?

I'm learning about operator overloading in C++, and I see that == and != are simply some special functions which can be …

c++ operator-overloading equality equality-operator
Case insensitive string comparison in Go

How do I compare strings in a case insensitive manner? For example, "Go" and "go" should be considered equal.

string go string-comparison equality case-insensitive
Why is (18446744073709551615 == -1) true?

When I was working on string::npos I noticed something and I couldn't find any explanation for it on the …

c++ equality unsigned signed integer-overflow
Test for equality to the default value

The following doesn't compile: public void MyMethod<T>(T value) { if (value == default(T)) { // do stuff } } Error: Operator …

c# generics equality