4
Answers

compile time error or runtime error?

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)