S
Simon Cheng
Hi,
Using VS.NET 2003, the following code fails compilation (as expected):
-------------------------------------------
using System;
class App
{
static public int I { get { return 1.0f; } } // Cannot implicitly
convert type 'float' to 'int'
static void Main() { Console.WriteLine(App.I); }
}
-------------------------------------------
But the following code compiles without any error:
-------------------------------------------
using System;
class App
{
static public float F { get { return 1; } } // <----- Shouldn't this be
caught as an error instead?
static void Main() { Console.WriteLine(App.F); }
}
-------------------------------------------
What am I missing?
Thanks,
Simon
Using VS.NET 2003, the following code fails compilation (as expected):
-------------------------------------------
using System;
class App
{
static public int I { get { return 1.0f; } } // Cannot implicitly
convert type 'float' to 'int'
static void Main() { Console.WriteLine(App.I); }
}
-------------------------------------------
But the following code compiles without any error:
-------------------------------------------
using System;
class App
{
static public float F { get { return 1; } } // <----- Shouldn't this be
caught as an error instead?
static void Main() { Console.WriteLine(App.F); }
}
-------------------------------------------
What am I missing?
Thanks,
Simon