[Mono-list] Dictionary<> key'ed by Decimal works differently between Mono and .NET
Robert Jordan
robertj at gmx.net
Thu Aug 4 06:30:49 EDT 2011
On 04.08.2011 12:14, Gareth Pearce wrote:
>>
> Looks like you have a typo - that should be 0.5m assigned to a?
Yes, thanks :) It turns out that Mono's Decimal.GetHashCode
is buggy:
using System;
class Test
{
static void Main ()
{
decimal a = 0.5m;
decimal b = Math.Round(10.5m - 10, 3);
Console.WriteLine (a == b);
Console.WriteLine (a.GetHashCode() == b.GetHashCode());
}
}
The output should be "true, true", but it's "true, false".
Robert
More information about the Mono-list
mailing list