[Mono-list] Dictionary<> key'ed by Decimal works differently between Mono and .NET

Mike Christensen mike at kitchenpc.com
Thu Aug 4 05:09:01 EDT 2011


I'm trying to get my unit tests to pass so I can try out my code on
Mono, however I ran into some different behavior using the
Dictionary<> class.  I've written a stand-alone test case to
illustrate the problem.

http://pastie.org/2318806

The code will print out "True" on .NET and "False" on Mono.  I believe
this is because I add the key as 0.5m to the dictionary, but I try to
look it up with 0.500m.  .NET will see these values as equal, Mono
will not.

Technically the numbers are equal, though they have different levels
of precision.  However, I'm of the opinion that Mono should emulate
.NET where-ever possible.

Mike


More information about the Mono-list mailing list