tagged [equality]

Two .NET objects that are equal don't say they are

Two .NET objects that are equal don't say they are I have the following code: What's up with that? Is the only way to fix this to go with .Equals() method?

13 Jul at 22:24

Comparing XmlDocument for equality (content wise)

Comparing XmlDocument for equality (content wise) If I want to compare the contents of a XMlDocument, is it just like this? I am not checking if they are both the same object reference, but if the CON...

27 May at 19:46

How do I compare strings in Java?

How do I compare strings in Java? I've been using the `==` operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into `.equals()` instead, and it fixe...

23 Jan at 13:36

Comparing arrays for equality in C++

Comparing arrays for equality in C++ Can someone please explain to me why the output from the following code is saying that arrays are ? ``` int main() { int iar1[] = {1,2,3,4,5}; int iar2[] = {1,...

19 Apr at 23:11

What's the fastest way to compare two arrays for equality?

What's the fastest way to compare two arrays for equality? I have two arrays of objects which are likely to have the same values, but in a different order, e.g. I wish to treat these two arrays as equ...

11 Nov at 09:50

Test for equality to the default value

Test for equality to the default value The following doesn't compile: `Operator '==' cannot be applied to operands of type 'T' and 'T'` I can't use `value == null` because `T` may be a struct. I can't...

13 Dec at 09:27

String comparison : operator==() vs. Equals()

String comparison : operator==() vs. Equals() > [C#: Are string.Equals() and == operator really same?](https://stackoverflow.com/questions/3678792/c-are-string-equals-and-operator-really-same) For s...

23 May at 11:53

Determine if 2 lists have the same elements, regardless of order?

Determine if 2 lists have the same elements, regardless of order? Sorry for the simple question, but I'm having a hard time finding the answer. When I compare 2 lists, I want to know if they are "equa...

15 Jan at 04:30

Comparing two List<string> for equality

Comparing two List for equality Other than stepping through the elements one by one, how do I compare two lists of strings for equality (in .NET 3.0): This fails: ``` // Expected result. List expect...

Resharper suggestion: check for reference equality instead

Resharper suggestion: check for reference equality instead I don't understand why Resharper suggest me to "check for reference equality instead" in this code: Why this should be better: ------------ED...

30 Nov at 15:35