Hi Radek,
yes you're missing something (not very) obvious, the intellisense doesn't
always show you the right overload. But i'm sure it is using the right. You
could check it with ildasm.
Is there, beside the intellisense another reason you think it's chosing the
wrong overload?
PS. You should better read the link, Jon gave you. This certanly is a case
where the Gui is superfluous. You could show the problem in simple Console
app with only one method.
"Radek Cerny" <ra*********@nospam.c1s.com.auschrieb im Newsbeitrag
news:eg**************@TK2MSFTNGP04.phx.gbl...
Thanks Jon,
Demo Attached.
Definitely a bug; forgot to mention using .Net 2
"Jon Skeet [C# MVP]" <sk***@pobox.comwrote in message
news:MP************************@msnews.microsoft.c om...
>Radek Cerny <ra*********@nospam.c1s.com.auwrote:
>>Hopefully I'm just missing something obvious, but this method (or more
likely the CLR/complier) has a bug where I can not use the overloaded
version:
Round( double value, int digits )
It always seems to use the Round(decimal value, int decimals) version,
no
matter what the first parameter is - double or decimal. Intellisense
agrees
with the compiler - incorrectly.
Is it me, a known issue or a new issue? I need this quite desparately;
I do
have a workaround where I check the scale of the number and do fancy
stuff
assuming it will Round to decimal places rather than digits but its just
too
ugly to bear wth for long.
Could you post a short but complete program which demonstrates the
problem?
See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
If you compile the following code and then look at it in Reflector or
ILDASM, I think you'll see it calling the right one:
using System;
class Test
{
static void Main()
{
double d = 0.2;
Console.WriteLine (Math.Round(d, 2));
}
}
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too