4
Reply

compile time error or runtime error?

George George

George George

May 4 2008 5:45 AM
2.6k

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)