Here’s a small snippet of code, when called it outputs ‘double’. Why? What’s the reasoning behind this. Why doesn’t it print ‘float’?
class source
{
static void Main()
{
Receiver r = new Receiver();
r.Method1(1.1);
}
}
class Receiver
{
public virtual void Method1(double f) { Debug.Print("double"); }
public virtual void Method1(float f) { Debug.Print("float"); }
}
TIA
To specify float call like this:
Otherwise it’ll default to double, like you observed.
Here’s a porition of the MSDN documentation on double that explains why: