Hi,
1.1
is interpreted as a
double
, not as a
float
. You need to add suffix
f for float (
1.1f
). Also,
double
has
optional suffix
d.
Here's equivalent example in a console application:
class Program
{
static void Main(string[] args)
{
add(1);
add(1.1f);
add(1.1);
Console.ReadLine();
}
static void add(int i)
{
Console.WriteLine("int i");
}
static void add(float i)
{
Console.WriteLine("float i");
}
static void add(double i)
{
Console.WriteLine("double i");
}
}
Result:
int i<br />
float i<br />
double i