George George

George George

  • NA
  • 778
  • 0

compile time error or runtime error?

May 4 2008 5:45 AM

Hello everyone,


Could anyone let me know why compiler can not make runtime error report in the following code, other than throw cast exception during runtime?

[Code]
    static void Main()
    {
        int i = 100;
        object b = i;
        long l = (long)b; // why compiler can not make type check here?

        return;
    }
[/Code]


thanks in advance,
George


Answers (4)