.NET: Strange behaviour of double.Equals() when boxing.

Posted by Vilx- on Stack Overflow See other posts from Stack Overflow or by Vilx-
Published on 2010-05-06T09:37:28Z Indexed on 2010/05/06 9:48 UTC
Read the original article Hit count: 318

Filed under:
|
|

What's going on here?

int zero = 0;
double x = 0;
object y = x;

Console.WriteLine(x.Equals(zero)); // True
Console.WriteLine(y.Equals(zero)); // False

© Stack Overflow or respective owner

Related posts about .NET

Related posts about boxing