Interview Questions

directcast(123.34,integer) - should it throw an error? Why or why not?

C# Interview Questions and Answers


(Continued from previous question...)

213. directcast(123.34,integer) - should it throw an error? Why or why not?

It would throw an InvalidCast exception as the runtime type of 123.34 (double) doesnt match with Integer.

(Continued on next question...)

Other Interview Questions